aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/connector/connector.txt5
-rw-r--r--drivers/connector/connector.c7
2 files changed, 7 insertions, 5 deletions
diff --git a/Documentation/connector/connector.txt b/Documentation/connector/connector.txt
index 57a314b14cf8..ad6e0ba7b38c 100644
--- a/Documentation/connector/connector.txt
+++ b/Documentation/connector/connector.txt
@@ -69,10 +69,11 @@ Unregisters new callback with connector core.
69 69
70struct cb_id *id - unique connector's user identifier. 70struct cb_id *id - unique connector's user identifier.
71 71
72void cn_netlink_send(struct cn_msg *msg, u32 __groups, int gfp_mask); 72int cn_netlink_send(struct cn_msg *msg, u32 __groups, int gfp_mask);
73 73
74Sends message to the specified groups. It can be safely called from 74Sends message to the specified groups. It can be safely called from
75any context, but may silently fail under strong memory pressure. 75softirq context, but may silently fail under strong memory pressure.
76If there are no listeners for given group -ESRCH can be returned.
76 77
77struct cn_msg * - message header(with attached data). 78struct cn_msg * - message header(with attached data).
78u32 __group - destination group. 79u32 __group - destination group.
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index 505677fb3157..d7125f4d9113 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -97,6 +97,9 @@ int cn_netlink_send(struct cn_msg *msg, u32 __group, gfp_t gfp_mask)
97 group = __group; 97 group = __group;
98 } 98 }
99 99
100 if (!netlink_has_listeners(dev->nls, group))
101 return -ESRCH;
102
100 size = NLMSG_SPACE(sizeof(*msg) + msg->len); 103 size = NLMSG_SPACE(sizeof(*msg) + msg->len);
101 104
102 skb = alloc_skb(size, gfp_mask); 105 skb = alloc_skb(size, gfp_mask);
@@ -111,9 +114,7 @@ int cn_netlink_send(struct cn_msg *msg, u32 __group, gfp_t gfp_mask)
111 114
112 NETLINK_CB(skb).dst_group = group; 115 NETLINK_CB(skb).dst_group = group;
113 116
114 netlink_broadcast(dev->nls, skb, 0, group, gfp_mask); 117 return netlink_broadcast(dev->nls, skb, 0, group, gfp_mask);
115
116 return 0;
117 118
118nlmsg_failure: 119nlmsg_failure:
119 kfree_skb(skb); 120 kfree_skb(skb);