Skip to contentSkip to conversation

Patch "IB/srp: fix invalid indirect_sg_entries parameter value" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Jan 30, 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

IB/srp: fix invalid indirect_sg_entries parameter value

to the 4.9-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:
ib-srp-fix-invalid-indirect_sg_entries-parameter-value.patch
and it can be found in the queue-4.9 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 0a475ef4226e305bdcffe12b401ca1eab06c4913 Mon Sep 17 00:00:00 2001

From: Israel Rukshin <[email protected]>
Date: Wed, 4 Jan 2017 15:59:37 +0200
Subject: IB/srp: fix invalid indirect_sg_entries parameter value

From: Israel Rukshin <[email protected]>

commit 0a475ef4226e305bdcffe12b401ca1eab06c4913 upstream.

After setting indirect_sg_entries module_param to huge value (e.g 500,000), srp_alloc_req_data() fails to allocate indirect descriptors for the request ring (kmalloc fails). This commit enforces the maximum value of indirect_sg_entries to be SG_MAX_SEGMENTS as signified in module param description.

Fixes 65e8617fba17 (scsi: rename SCSI_MAX_{SG, SG_CHAIN}_SEGMENTS)
Fixes c07d424d6118 (IB/srp: add support for indirect tables that don't fit in SRP_CMD)
---
 drivers/infiniband/ulp/srp/ib_srp.c |    6 ++++++
 1 file changed, 6 insertions(+)
drivers/infiniband/ulp/srp/ib_srp.c +6 -0
@@ -3683,6 +3683,12 @@ static int __init srp_init_module(void)
 		indirect_sg_entries = cmd_sg_entries;
 	}
 
+	if (indirect_sg_entries > SG_MAX_SEGMENTS) {
+		pr_warn("Clamping indirect_sg_entries to %u\n",
+			SG_MAX_SEGMENTS);
+		indirect_sg_entries = SG_MAX_SEGMENTS;
+	}
+
 	srp_remove_wq = create_workqueue("srp_remove");
 	if (!srp_remove_wq) {
 		ret = -ENOMEM;

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

queue-4.9/ib-srp-fix-mr-allocation-when-the-device-supports-sg-gaps.patch queue-4.9/ib-srp-fix-invalid-indirect_sg_entries-parameter-value.patch