]> git.baikalelectronics.ru Git - kernel.git/commit
netlink: hold nl_sock_hash_lock during diag dump
authorThomas Graf <tgraf@suug.ch>
Wed, 6 Aug 2014 23:18:47 +0000 (00:18 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 7 Aug 2014 02:17:44 +0000 (19:17 -0700)
commit832a83f0970ea13c43dfc258e9c4db494d8e47c8
treeb16af5d1fcabe792f0b565d9fca2686cad480efd
parentbbe5b0dda39b727e3b3bcfecf2777ba458b70d09
netlink: hold nl_sock_hash_lock during diag dump

Although RCU protection would be possible during diag dump, doing
so allows for concurrent table mutations which can render the
in-table offset between individual Netlink messages invalid and
thus cause legitimate sockets to be skipped in the dump.

Since the diag dump is relatively low volume and consistency is
more important than performance, the table mutex is held during
dump.

Reported-by: Andrey Wagin <avagin@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Fixes: 5f18ca185e81b1e ("netlink: Convert netlink_lookup() to use RCU protected hash table")
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netlink/af_netlink.c
net/netlink/af_netlink.h
net/netlink/diag.c