From 07859def5de0d909334a2e45e5e428f393e8cc9e Mon Sep 17 00:00:00 2001 From: Sebastian Sanchez Date: Thu, 10 Dec 2015 16:02:49 -0500 Subject: [PATCH] staging/rdma/hfi1: Fix for module parameter hdrq_entsize when it's 0 If driver is loaded with parameter hdrq_entsize=0, then there's a NULL dereference when the driver gets unloaded. This causes a kernel Oops and prevents the module from being unloaded. This patch fixes this issue by making sure -EINVAL gets returned when hdrq_entsize=0. Reviewed-by: Chegondi, Harish Reviewed-by: Haralanov, Mitko Signed-off-by: Sebastian Sanchez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/init.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/rdma/hfi1/init.c b/drivers/staging/rdma/hfi1/init.c index 2d52f91c03dc..467ff26bcab0 100644 --- a/drivers/staging/rdma/hfi1/init.c +++ b/drivers/staging/rdma/hfi1/init.c @@ -1351,6 +1351,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) if (!encode_rcv_header_entry_size(hfi1_hdrq_entsize)) { hfi1_early_err(&pdev->dev, "Invalid HdrQ Entry size %u\n", hfi1_hdrq_entsize); + ret = -EINVAL; goto bail; } -- 2.39.2