Patch "RDMA/cxgb4: add null-ptr-check after ip_dev_find()" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

    RDMA/cxgb4: add null-ptr-check after ip_dev_find()

to the 5.15-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-cxgb4-add-null-ptr-check-after-ip_dev_find.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit ce0fd898becaca98892a837c76a3f687138cca7f
Author: Nikita Zhandarovich <n.zhandarovich@xxxxxxxxxx>
Date:   Wed Feb 1 09:21:03 2023 -0800

    RDMA/cxgb4: add null-ptr-check after ip_dev_find()
    
    [ Upstream commit ef42520240aacfc0d46c8d780c051d135a8dc9b7 ]
    
    ip_dev_find() may return NULL and assign it to pdev which is
    dereferenced later.
    Fix this by checking the return value of ip_dev_find() for NULL
    similar to the way it is done with other instances of said function.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: 1cab775c3e75 ("RDMA/cxgb4: Fix LE hash collision bug for passive open connection")
    Signed-off-by: Nikita Zhandarovich <n.zhandarovich@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230201172103.17261-1-n.zhandarovich@xxxxxxxxxx
    Signed-off-by: Leon Romanovsky <leon@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index 291471d12197f..56f46a16e6575 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -4150,6 +4150,10 @@ static int rx_pkt(struct c4iw_dev *dev, struct sk_buff *skb)
 
 	if (neigh->dev->flags & IFF_LOOPBACK) {
 		pdev = ip_dev_find(&init_net, iph->daddr);
+		if (!pdev) {
+			pr_err("%s - failed to find device!\n", __func__);
+			goto free_dst;
+		}
 		e = cxgb4_l2t_get(dev->rdev.lldi.l2t, neigh,
 				    pdev, 0);
 		pi = (struct port_info *)netdev_priv(pdev);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux