]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
staging/rdma/hfi1: Fix for module parameter hdrq_entsize when it's 0
authorSebastian Sanchez <sebastian.sanchez@intel.com>
Thu, 10 Dec 2015 21:02:49 +0000 (16:02 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Dec 2015 22:00:17 +0000 (14:00 -0800)
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 <harish.chegondi@intel.com>
Reviewed-by: Haralanov, Mitko <mitko.haralanov@intel.com>
Signed-off-by: Sebastian Sanchez <sebastian.sanchez@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rdma/hfi1/init.c

index 2d52f91c03dc363d87412ea96e80b39e91cf1810..467ff26bcab0ee9c6cbf90de867387025d47886e 100644 (file)
@@ -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;
        }