OSDN Git Service

neighbor: gc_list changes should be protected by table lock
authorDavid Ahern <dsahern@gmail.com>
Mon, 10 Dec 2018 21:54:07 +0000 (13:54 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 11 Dec 2018 01:41:35 +0000 (17:41 -0800)
commit8cc196d6ef86bbab01dbf16f6c596cf56aa0839e
treedf782409e9117f4a333bc68cd2567ffc96070270
parent93698321f72cb351ae6ab59185b611ba26e6e1d0
neighbor: gc_list changes should be protected by table lock

Adding and removing neighbor entries to / from the gc_list need to be
done while holding the table lock; a couple of places were missed in the
original patch.

Move the list_add_tail in neigh_alloc to ___neigh_create where the lock
is already obtained. Since neighbor entries should rarely be moved
to/from PERMANENT state, add lock/unlock around the gc_list changes in
neigh_change_state rather than extending the lock hold around all
neighbor updates.

Fixes: 58956317c8de ("neighbor: Improve garbage collection")
Reported-by: Andrei Vagin <avagin@gmail.com>
Reported-by: syzbot+6cc2fd1d3bdd2e007363@syzkaller.appspotmail.com
Reported-by: syzbot+35e87b87c00f386b041f@syzkaller.appspotmail.com
Reported-by: syzbot+b354d1fb59091ea73c37@syzkaller.appspotmail.com
Reported-by: syzbot+3ddead5619658537909b@syzkaller.appspotmail.com
Reported-by: syzbot+424d47d5c456ce8b2bbe@syzkaller.appspotmail.com
Reported-by: syzbot+e4d42eb35f6a27b0a628@syzkaller.appspotmail.com
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/neighbour.c