|
@@ -301,23 +301,26 @@ static int kobject_uevent_net_broadcast(struct kobject *kobj,
|
|
{
|
|
{
|
|
int retval = 0;
|
|
int retval = 0;
|
|
#if defined(CONFIG_NET)
|
|
#if defined(CONFIG_NET)
|
|
|
|
+ struct sk_buff *skb = NULL;
|
|
struct uevent_sock *ue_sk;
|
|
struct uevent_sock *ue_sk;
|
|
|
|
|
|
/* send netlink message */
|
|
/* send netlink message */
|
|
list_for_each_entry(ue_sk, &uevent_sock_list, list) {
|
|
list_for_each_entry(ue_sk, &uevent_sock_list, list) {
|
|
struct sock *uevent_sock = ue_sk->sk;
|
|
struct sock *uevent_sock = ue_sk->sk;
|
|
- struct sk_buff *skb;
|
|
|
|
- size_t len;
|
|
|
|
|
|
|
|
if (!netlink_has_listeners(uevent_sock, 1))
|
|
if (!netlink_has_listeners(uevent_sock, 1))
|
|
continue;
|
|
continue;
|
|
|
|
|
|
- /* allocate message with the maximum possible size */
|
|
|
|
- len = strlen(action_string) + strlen(devpath) + 2;
|
|
|
|
- skb = alloc_skb(len + env->buflen, GFP_KERNEL);
|
|
|
|
- if (skb) {
|
|
|
|
|
|
+ if (!skb) {
|
|
|
|
+ /* allocate message with the maximum possible size */
|
|
|
|
+ size_t len = strlen(action_string) + strlen(devpath) + 2;
|
|
char *scratch;
|
|
char *scratch;
|
|
|
|
|
|
|
|
+ retval = -ENOMEM;
|
|
|
|
+ skb = alloc_skb(len + env->buflen, GFP_KERNEL);
|
|
|
|
+ if (!skb)
|
|
|
|
+ continue;
|
|
|
|
+
|
|
/* add header */
|
|
/* add header */
|
|
scratch = skb_put(skb, len);
|
|
scratch = skb_put(skb, len);
|
|
sprintf(scratch, "%s@%s", action_string, devpath);
|
|
sprintf(scratch, "%s@%s", action_string, devpath);
|
|
@@ -325,16 +328,17 @@ static int kobject_uevent_net_broadcast(struct kobject *kobj,
|
|
skb_put_data(skb, env->buf, env->buflen);
|
|
skb_put_data(skb, env->buf, env->buflen);
|
|
|
|
|
|
NETLINK_CB(skb).dst_group = 1;
|
|
NETLINK_CB(skb).dst_group = 1;
|
|
- retval = netlink_broadcast_filtered(uevent_sock, skb,
|
|
|
|
- 0, 1, GFP_KERNEL,
|
|
|
|
- kobj_bcast_filter,
|
|
|
|
- kobj);
|
|
|
|
- /* ENOBUFS should be handled in userspace */
|
|
|
|
- if (retval == -ENOBUFS || retval == -ESRCH)
|
|
|
|
- retval = 0;
|
|
|
|
- } else
|
|
|
|
- retval = -ENOMEM;
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ retval = netlink_broadcast_filtered(uevent_sock, skb_get(skb),
|
|
|
|
+ 0, 1, GFP_KERNEL,
|
|
|
|
+ kobj_bcast_filter,
|
|
|
|
+ kobj);
|
|
|
|
+ /* ENOBUFS should be handled in userspace */
|
|
|
|
+ if (retval == -ENOBUFS || retval == -ESRCH)
|
|
|
|
+ retval = 0;
|
|
}
|
|
}
|
|
|
|
+ consume_skb(skb);
|
|
#endif
|
|
#endif
|
|
return retval;
|
|
return retval;
|
|
}
|
|
}
|