Home Home > GIT Browse > openSUSE-15.1
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-05-10 14:13:58 +0200
committerJiri Slaby <jslaby@suse.cz>2019-05-16 08:28:02 +0200
commit03c8e1b6ca7c0089950b3e1bcd71c9e817493c1b (patch)
tree3659be48503762a6f30f0d838545bbf78895c251
parent3267ee61a869f8cb830853c50bba45da79b65f7a (diff)
genetlink: Fix a memory leak on error path
(networking-stable-19_03_28).
-rw-r--r--patches.suse/genetlink-Fix-a-memory-leak-on-error-path.patch45
-rw-r--r--series.conf1
2 files changed, 46 insertions, 0 deletions
diff --git a/patches.suse/genetlink-Fix-a-memory-leak-on-error-path.patch b/patches.suse/genetlink-Fix-a-memory-leak-on-error-path.patch
new file mode 100644
index 0000000000..0df45b8fe5
--- /dev/null
+++ b/patches.suse/genetlink-Fix-a-memory-leak-on-error-path.patch
@@ -0,0 +1,45 @@
+From: YueHaibing <yuehaibing@huawei.com>
+Date: Thu, 21 Mar 2019 15:02:50 +0800
+Subject: genetlink: Fix a memory leak on error path
+Git-commit: ceabee6c59943bdd5e1da1a6a20dc7ee5f8113a2
+Patch-mainline: v5.1-rc3
+References: networking-stable-19_03_28
+
+In genl_register_family(), when idr_alloc() fails,
+we forget to free the memory we possibly allocate for
+family->attrbuf.
+
+Reported-by: Hulk Robot <hulkci@huawei.com>
+Fixes: 2ae0f17df1cd ("genetlink: use idr to track families")
+Signed-off-by: YueHaibing <yuehaibing@huawei.com>
+Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ net/netlink/genetlink.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
+index 25eeb6d2a75a..f0ec068e1d02 100644
+--- a/net/netlink/genetlink.c
++++ b/net/netlink/genetlink.c
+@@ -366,7 +366,7 @@ int genl_register_family(struct genl_family *family)
+ start, end + 1, GFP_KERNEL);
+ if (family->id < 0) {
+ err = family->id;
+- goto errout_locked;
++ goto errout_free;
+ }
+
+ err = genl_validate_assign_mc_groups(family);
+@@ -385,6 +385,7 @@ int genl_register_family(struct genl_family *family)
+
+ errout_remove:
+ idr_remove(&genl_fam_idr, family->id);
++errout_free:
+ kfree(family->attrbuf);
+ errout_locked:
+ genl_unlock_all();
+--
+2.21.0
+
diff --git a/series.conf b/series.conf
index 0519a0a447..e57a34eefd 100644
--- a/series.conf
+++ b/series.conf
@@ -21590,6 +21590,7 @@
patches.suse/tcp-do-not-use-ipv6-header-for-ipv4-flow.patch
patches.suse/dccp-do-not-use-ipv6-header-for-ipv4-flow.patch
patches.suse/net-packet-Set-__GFP_NOWARN-upon-allocation-in-alloc.patch
+ patches.suse/genetlink-Fix-a-memory-leak-on-error-path.patch
patches.fixes/0001-netfilter-bridge-set-skb-transport_header-before-ent.patch
patches.fixes/rhashtable-Still-do-rehash-when-we-get-EEXIST.patch
patches.fixes/bpf-do-not-restore-dst_reg-when-cur_state-is-freed.patch