Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netlink: Export genl_lock() API for use by modules

This lets kernel modules which use genl netlink APIs serialize netlink
processing.

Signed-off-by: James Chapman <jchapman@katalix.com>
Reviewed-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

James Chapman and committed by
David S. Miller
f408e0ce 0d76751f

+12 -2
+8
include/linux/genetlink.h
··· 80 80 81 81 #define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1) 82 82 83 + #ifdef __KERNEL__ 84 + 85 + /* All generic netlink requests are serialized by a global lock. */ 86 + extern void genl_lock(void); 87 + extern void genl_unlock(void); 88 + 89 + #endif /* __KERNEL__ */ 90 + 83 91 #endif /* __LINUX_GENERIC_NETLINK_H */
+4 -2
net/netlink/genetlink.c
··· 20 20 21 21 static DEFINE_MUTEX(genl_mutex); /* serialization of message processing */ 22 22 23 - static inline void genl_lock(void) 23 + void genl_lock(void) 24 24 { 25 25 mutex_lock(&genl_mutex); 26 26 } 27 + EXPORT_SYMBOL(genl_lock); 27 28 28 - static inline void genl_unlock(void) 29 + void genl_unlock(void) 29 30 { 30 31 mutex_unlock(&genl_mutex); 31 32 } 33 + EXPORT_SYMBOL(genl_unlock); 32 34 33 35 #define GENL_FAM_TAB_SIZE 16 34 36 #define GENL_FAM_TAB_MASK (GENL_FAM_TAB_SIZE - 1)