linux/net/mctp/test
Matt Johnston dc121c0084 mctp: make __mctp_dev_get() take a refcount hold
Previously there was a race that could allow the mctp_dev refcount
to hit zero:

rcu_read_lock();
mdev = __mctp_dev_get(dev);
// mctp_unregister() happens here, mdev->refs hits zero
mctp_dev_hold(dev);
rcu_read_unlock();

Now we make __mctp_dev_get() take the hold itself. It is safe to test
against the zero refcount because __mctp_dev_get() is called holding
rcu_read_lock and mctp_dev uses kfree_rcu().

Reported-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-02-23 12:29:15 +00:00
..
route-test.c mctp: Allow keys matching any local address 2022-02-09 12:00:11 +00:00
utils.c mctp: make __mctp_dev_get() take a refcount hold 2022-02-23 12:29:15 +00:00
utils.h mctp: Add test utils 2021-10-03 14:35:41 +01:00