Skip to contentSkip to conversation

Patch "RDMA/hns: Avoid NULL pointer exception" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Dec 20, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

RDMA/hns: Avoid NULL pointer exception

to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
rdma-hns-avoid-null-pointer-exception.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Wed Dec 20 18:17:52 CET 2017

From: "Wei Hu(Xavier)" <[email protected]>
Date: Fri, 29 Sep 2017 23:10:12 +0800
Subject: RDMA/hns: Avoid NULL pointer exception

From: "Wei Hu(Xavier)" <[email protected]>

[ Upstream commit 5e437b1d7e8d31ff9a4b8e898eb3a6cee309edd9 ]

After the loop in hns_roce_v1_mr_free_work_fn function, it is possible that all qps will have been freed (in which case ne will be 0). If that happens, then later in the function when we dereference hr_qp we will get an exception. Check ne is not 0 to make sure we actually have an hr_qp left to work on.

This patch fixes the smatch error as below:
drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1009 hns_roce_v1_mr_free_work_fn()
error: we previously assumed 'hr_qp' could be null

---
 drivers/infiniband/hw/hns/hns_roce_hw_v1.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/infiniband/hw/hns/hns_roce_hw_v1.c +5 -0
@@ -1001,6 +1001,11 @@ static void hns_roce_v1_mr_free_work_fn(
 		}
 	}
 
+	if (!ne) {
+		dev_err(dev, "Reseved loop qp is absent!\n");
+		goto free_work;
+	}
+
 	do {
 		ret = hns_roce_v1_poll_cq(&mr_free_cq->ib_cq, ne, wc);
 		if (ret < 0) {

Patches currently in stable-queue which might be from [email protected] are

queue-4.14/rdma-hns-avoid-null-pointer-exception.patch