Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af65bdfc authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller
Browse files

[NETLINK]: Switch cb_lock spinlock to mutex and allow to override it



Switch cb_lock to mutex and allow netlink kernel users to override it
with a subsystem specific mutex for consistent locking in dump callbacks.
All netlink_dump_start users have been audited not to rely on any
side-effects of the previously used spinlock.

Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b076deb8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -448,7 +448,7 @@ static int __devinit cn_init(void)

	dev->nls = netlink_kernel_create(NETLINK_CONNECTOR,
					 CN_NETLINK_USERS + 0xf,
					 dev->input, THIS_MODULE);
					 dev->input, NULL, THIS_MODULE);
	if (!dev->nls)
		return -EIO;

+2 −1
Original line number Diff line number Diff line
@@ -168,7 +168,8 @@ scsi_netlink_init(void)
	}

	scsi_nl_sock = netlink_kernel_create(NETLINK_SCSITRANSPORT,
				SCSI_NL_GRP_CNT, scsi_nl_rcv, THIS_MODULE);
				SCSI_NL_GRP_CNT, scsi_nl_rcv, NULL,
				THIS_MODULE);
	if (!scsi_nl_sock) {
		printk(KERN_ERR "%s: register of recieve handler failed\n",
				__FUNCTION__);
+1 −1
Original line number Diff line number Diff line
@@ -1435,7 +1435,7 @@ static __init int iscsi_transport_init(void)
	if (err)
		goto unregister_conn_class;

	nls = netlink_kernel_create(NETLINK_ISCSI, 1, iscsi_if_rx,
	nls = netlink_kernel_create(NETLINK_ISCSI, 1, iscsi_if_rx, NULL,
			THIS_MODULE);
	if (!nls) {
		err = -ENOBUFS;
+1 −1
Original line number Diff line number Diff line
@@ -229,7 +229,7 @@ int ecryptfs_init_netlink(void)

	ecryptfs_nl_sock = netlink_kernel_create(NETLINK_ECRYPTFS, 0,
						 ecryptfs_receive_nl_message,
						 THIS_MODULE);
						 NULL, THIS_MODULE);
	if (!ecryptfs_nl_sock) {
		rc = -EIO;
		ecryptfs_printk(KERN_ERR, "Failed to create netlink socket\n");
+4 −1
Original line number Diff line number Diff line
@@ -157,7 +157,10 @@ struct netlink_skb_parms
#define NETLINK_CREDS(skb)	(&NETLINK_CB((skb)).creds)


extern struct sock *netlink_kernel_create(int unit, unsigned int groups, void (*input)(struct sock *sk, int len), struct module *module);
extern struct sock *netlink_kernel_create(int unit, unsigned int groups,
					  void (*input)(struct sock *sk, int len),
					  struct mutex *cb_mutex,
					  struct module *module);
extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
extern int netlink_has_listeners(struct sock *sk, unsigned int group);
extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock);
Loading