mctp: locking, lifetime and validity changes for sk_keys
authorJeremy Kerr <jk@codeconstruct.com.au>
Wed, 29 Sep 2021 07:26:07 +0000 (15:26 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 29 Sep 2021 10:00:11 +0000 (11:00 +0100)
commit73c618456dc5cf2acb597256d633060cf75de8d6
treea9efbe38933f94dae310553d398ccb2989acc554
parent1f6c77ac9e6ecef152fd5df94c4b3c346adb197a
mctp: locking, lifetime and validity changes for sk_keys

We will want to invalidate sk_keys in a future change, which will
require a boolean flag to mark invalidated items in the socket & net
namespace lists. We'll also need to take a reference to keys, held over
non-atomic contexts, so we need a refcount on keys also.

This change adds a validity flag (currently always true) and refcount to
struct mctp_sk_key.  With a refcount on the keys, using RCU no longer
makes much sense; we have exact indications on the lifetime of keys. So,
we also change the RCU list traversal to a locked implementation.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/mctp.h
net/mctp/af_mctp.c
net/mctp/route.c