genetlink: introduce and use genl_family_attrbuf()
This helper function allows family implementations to access their family's attrbuf. This gets rid of the attrbuf usage in families, and also adds locking validation, since it's not valid to use the attrbuf with parallel_ops or outside of the dumpit callback. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
4fe77d82ef
commit
c90c39dab3
@@ -1096,6 +1096,25 @@ problem:
|
||||
|
||||
subsys_initcall(genl_init);
|
||||
|
||||
/**
|
||||
* genl_family_attrbuf - return family's attrbuf
|
||||
* @family: the family
|
||||
*
|
||||
* Return the family's attrbuf, while validating that it's
|
||||
* actually valid to access it.
|
||||
*
|
||||
* You cannot use this function with a family that has parallel_ops
|
||||
* and you can only use it within (pre/post) doit/dumpit callbacks.
|
||||
*/
|
||||
struct nlattr **genl_family_attrbuf(struct genl_family *family)
|
||||
{
|
||||
if (!WARN_ON(family->parallel_ops))
|
||||
lockdep_assert_held(&genl_mutex);
|
||||
|
||||
return family->attrbuf;
|
||||
}
|
||||
EXPORT_SYMBOL(genl_family_attrbuf);
|
||||
|
||||
static int genlmsg_mcast(struct sk_buff *skb, u32 portid, unsigned long group,
|
||||
gfp_t flags)
|
||||
{
|
||||
|
Reference in New Issue
Block a user