Home Home > GIT Browse > SLE12-SP4
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-07-18 08:26:13 +0200
committerJiri Slaby <jslaby@suse.cz>2019-07-18 09:30:37 +0200
commit15a7753cd5378fa14a8e7dec2decd7bbcb9aae5b (patch)
treeb2c9019b139aa6918043e5047e11076ebd52d699
parent07894ad6aec7c0480055b2f47f907233f3dc996c (diff)
net: rds: fix memory leak in rds_ib_flush_mr_pool
(networking-stable-19_06_09).
-rw-r--r--patches.suse/net-rds-fix-memory-leak-in-rds_ib_flush_mr_pool.patch88
-rw-r--r--series.conf1
2 files changed, 89 insertions, 0 deletions
diff --git a/patches.suse/net-rds-fix-memory-leak-in-rds_ib_flush_mr_pool.patch b/patches.suse/net-rds-fix-memory-leak-in-rds_ib_flush_mr_pool.patch
new file mode 100644
index 0000000000..be69d22ad8
--- /dev/null
+++ b/patches.suse/net-rds-fix-memory-leak-in-rds_ib_flush_mr_pool.patch
@@ -0,0 +1,88 @@
+From: Zhu Yanjun <yanjun.zhu@oracle.com>
+Date: Thu, 6 Jun 2019 04:00:03 -0400
+Subject: net: rds: fix memory leak in rds_ib_flush_mr_pool
+Git-commit: 85cb928787eab6a2f4ca9d2a798b6f3bed53ced1
+Patch-mainline: 5.2-rc4
+References: networking-stable-19_06_09
+
+When the following tests last for several hours, the problem will occur.
+
+Server:
+ rds-stress -r 1.1.1.16 -D 1M
+Client:
+ rds-stress -r 1.1.1.14 -s 1.1.1.16 -D 1M -T 30
+
+The following will occur.
+
+"
+Starting up....
+tsks tx/s rx/s tx+rx K/s mbi K/s mbo K/s tx us/c rtt us cpu
+%
+ 1 0 0 0.00 0.00 0.00 0.00 0.00 -1.00
+ 1 0 0 0.00 0.00 0.00 0.00 0.00 -1.00
+ 1 0 0 0.00 0.00 0.00 0.00 0.00 -1.00
+ 1 0 0 0.00 0.00 0.00 0.00 0.00 -1.00
+"
+>From vmcore, we can find that clean_list is NULL.
+
+>From the source code, rds_mr_flushd calls rds_ib_mr_pool_flush_worker.
+Then rds_ib_mr_pool_flush_worker calls
+"
+ rds_ib_flush_mr_pool(pool, 0, NULL);
+"
+Then in function
+"
+int rds_ib_flush_mr_pool(struct rds_ib_mr_pool *pool,
+ int free_all, struct rds_ib_mr **ibmr_ret)
+"
+ibmr_ret is NULL.
+
+In the source code,
+"
+...
+list_to_llist_nodes(pool, &unmap_list, &clean_nodes, &clean_tail);
+if (ibmr_ret)
+ *ibmr_ret = llist_entry(clean_nodes, struct rds_ib_mr, llnode);
+
+/* more than one entry in llist nodes */
+if (clean_nodes->next)
+ llist_add_batch(clean_nodes->next, clean_tail, &pool->clean_list);
+...
+"
+When ibmr_ret is NULL, llist_entry is not executed. clean_nodes->next
+instead of clean_nodes is added in clean_list.
+So clean_nodes is discarded. It can not be used again.
+The workqueue is executed periodically. So more and more clean_nodes are
+discarded. Finally the clean_list is NULL.
+Then this problem will occur.
+
+Fixes: 1bc144b62524 ("net, rds, Replace xlist in net/rds/xlist.h with llist")
+Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
+Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ net/rds/ib_rdma.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+--- a/net/rds/ib_rdma.c
++++ b/net/rds/ib_rdma.c
+@@ -416,12 +416,14 @@ int rds_ib_flush_mr_pool(struct rds_ib_m
+ wait_clean_list_grace();
+
+ list_to_llist_nodes(pool, &unmap_list, &clean_nodes, &clean_tail);
+- if (ibmr_ret)
++ if (ibmr_ret) {
+ *ibmr_ret = llist_entry(clean_nodes, struct rds_ib_mr, llnode);
+-
++ clean_nodes = clean_nodes->next;
++ }
+ /* more than one entry in llist nodes */
+- if (clean_nodes->next)
+- llist_add_batch(clean_nodes->next, clean_tail, &pool->clean_list);
++ if (clean_nodes)
++ llist_add_batch(clean_nodes, clean_tail,
++ &pool->clean_list);
+
+ }
+
diff --git a/series.conf b/series.conf
index 644fda855c..2f3ec92e26 100644
--- a/series.conf
+++ b/series.conf
@@ -22713,6 +22713,7 @@
patches.suse/ethtool-fix-potential-userspace-buffer-overflow.patch
patches.suse/ipv6-use-READ_ONCE-for-inet-hdrincl-as-in-ipv4.patch
patches.suse/ipv6-fix-EFAULT-on-sendto-with-icmpv6-and-hdrincl.patch
+ patches.suse/net-rds-fix-memory-leak-in-rds_ib_flush_mr_pool.patch
patches.drivers/net-mvpp2-Use-strscpy-to-handle-stat-strings.patch
patches.fixes/pktgen-do-not-sleep-with-the-thread-lock-held.patch
patches.drivers/hwmon-core-add-thermal-sensors-only-if-dev-of_node-i.patch