ibmvnic: fix: NULL pointer dereference.
authorYANG LI <abaci-bugfix@linux.alibaba.com>
Wed, 30 Dec 2020 07:23:14 +0000 (15:23 +0800)
committerJakub Kicinski <kuba@kernel.org>
Mon, 4 Jan 2021 21:23:33 +0000 (13:23 -0800)
The error is due to dereference a null pointer in function
reset_one_sub_crq_queue():

if (!scrq) {
    netdev_dbg(adapter->netdev,
               "Invalid scrq reset. irq (%d) or msgs(%p).\n",
scrq->irq, scrq->msgs);
return -EINVAL;
}

If the expression is true, scrq must be a null pointer and cannot
dereference.

Fixes: 9281cf2d5840 ("ibmvnic: avoid memset null scrq msgs")
Signed-off-by: YANG LI <abaci-bugfix@linux.alibaba.com>
Reported-by: Abaci <abaci@linux.alibaba.com>
Acked-by: Lijun Pan <ljp@linux.ibm.com>
Link: https://lore.kernel.org/r/1609312994-121032-1-git-send-email-abaci-bugfix@linux.alibaba.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/ibm/ibmvnic.c

index 91ebcde30292cc8ce3c5b38b4b3149c4c0aaeeec..9778c83150f1cc4508864d593bb5d33487c416db 100644 (file)
@@ -2981,9 +2981,7 @@ static int reset_one_sub_crq_queue(struct ibmvnic_adapter *adapter,
        int rc;
 
        if (!scrq) {
-               netdev_dbg(adapter->netdev,
-                          "Invalid scrq reset. irq (%d) or msgs (%p).\n",
-                          scrq->irq, scrq->msgs);
+               netdev_dbg(adapter->netdev, "Invalid scrq reset.\n");
                return -EINVAL;
        }