Home Home > GIT Browse > SLE15-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Kubecek <mkubecek@suse.cz>2019-02-14 18:06:46 +0100
committerMichal Kubecek <mkubecek@suse.cz>2019-02-14 18:06:46 +0100
commitd7be40afa28a50b1ff275512c7f8a18982fd93d9 (patch)
tree4139043e9b7685d324cffe98a932b501484a8a8b
parentfba27e2a78f08d94ce19c33e2942902acc037b55 (diff)
uevent: add alloc_uevent_skb() helper (bsc#1122982).
-rw-r--r--patches.fixes/uevent-add-alloc_uevent_skb-helper.patch90
-rw-r--r--series.conf1
2 files changed, 91 insertions, 0 deletions
diff --git a/patches.fixes/uevent-add-alloc_uevent_skb-helper.patch b/patches.fixes/uevent-add-alloc_uevent_skb-helper.patch
new file mode 100644
index 0000000000..369d2bba39
--- /dev/null
+++ b/patches.fixes/uevent-add-alloc_uevent_skb-helper.patch
@@ -0,0 +1,90 @@
+From: Christian Brauner <christian.brauner@ubuntu.com>
+Date: Sun, 29 Apr 2018 12:44:11 +0200
+Subject: uevent: add alloc_uevent_skb() helper
+Patch-mainline: v4.18-rc1
+Git-commit: 26045a7b14bc7a5455e411d820110f66557d6589
+References: bsc#1122982
+
+This patch adds alloc_uevent_skb() in preparation for follow up patches.
+
+Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Acked-by: Michal Kubecek <mkubecek@suse.cz>
+
+---
+ lib/kobject_uevent.c | 47 ++++++++++++++++++++++++++++++++------------
+ 1 file changed, 34 insertions(+), 13 deletions(-)
+
+--- a/lib/kobject_uevent.c
++++ b/lib/kobject_uevent.c
+@@ -23,6 +23,7 @@
+ #include <linux/socket.h>
+ #include <linux/skbuff.h>
+ #include <linux/netlink.h>
++#include <linux/uidgid.h>
+ #include <net/sock.h>
+ #include <net/net_namespace.h>
+
+@@ -153,6 +154,38 @@ static void cleanup_uevent_env(struct subprocess_info *info)
+ }
+ #endif
+
++#ifdef CONFIG_NET
++static struct sk_buff *alloc_uevent_skb(struct kobj_uevent_env *env,
++ const char *action_string,
++ const char *devpath)
++{
++ struct netlink_skb_parms *parms;
++ struct sk_buff *skb = NULL;
++ char *scratch;
++ size_t len;
++
++ /* allocate message with maximum possible size */
++ len = strlen(action_string) + strlen(devpath) + 2;
++ skb = alloc_skb(len + env->buflen, GFP_KERNEL);
++ if (!skb)
++ return NULL;
++
++ /* add header */
++ scratch = skb_put(skb, len);
++ sprintf(scratch, "%s@%s", action_string, devpath);
++
++ skb_put_data(skb, env->buf, env->buflen);
++
++ parms = &NETLINK_CB(skb);
++ parms->creds.uid = GLOBAL_ROOT_UID;
++ parms->creds.gid = GLOBAL_ROOT_GID;
++ parms->dst_group = 1;
++ parms->portid = 0;
++
++ return skb;
++}
++#endif
++
+ static int kobject_uevent_net_broadcast(struct kobject *kobj,
+ struct kobj_uevent_env *env,
+ const char *action_string,
+@@ -171,22 +204,10 @@ static int kobject_uevent_net_broadcast(struct kobject *kobj,
+ continue;
+
+ if (!skb) {
+- /* allocate message with the maximum possible size */
+- size_t len = strlen(action_string) + strlen(devpath) + 2;
+- char *scratch;
+-
+ retval = -ENOMEM;
+- skb = alloc_skb(len + env->buflen, GFP_KERNEL);
++ skb = alloc_uevent_skb(env, action_string, devpath);
+ if (!skb)
+ continue;
+-
+- /* add header */
+- scratch = skb_put(skb, len);
+- sprintf(scratch, "%s@%s", action_string, devpath);
+-
+- skb_put_data(skb, env->buf, env->buflen);
+-
+- NETLINK_CB(skb).dst_group = 1;
+ }
+
+ retval = netlink_broadcast_filtered(uevent_sock, skb_get(skb),
diff --git a/series.conf b/series.conf
index 5254fad0f7..f62c1a5a82 100644
--- a/series.conf
+++ b/series.conf
@@ -16462,6 +16462,7 @@
patches.drivers/i40evf-Fix-turning-TSO-GSO-and-GRO-on-after.patch
patches.drivers/i40e-Fix-multiple-issues-with-UDP-tunnel-offload-fil.patch
patches.drivers/i40e-avoid-overflow-in-i40e_ptp_adjfreq.patch
+ patches.fixes/uevent-add-alloc_uevent_skb-helper.patch
patches.drivers/net-hns3-Remove-error-log-when-getting-pfc-stats-fai.patch
patches.drivers/net-hns3-fix-to-correctly-fetch-l4-protocol-outer-he.patch
patches.drivers/net-hns3-Fixes-the-out-of-bounds-access-in-hclge_map.patch