Patch "RDMA/cxgb4: Added NULL check for lookup_atid" has been added to the 4.19-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: Added NULL check for lookup_atid

to the 4.19-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-added-null-check-for-lookup_atid.patch
and it can be found in the queue-4.19 subdirectory.

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



commit 877b63a1dd98ddce7da690fe7a71cb4a28c1e53c
Author: Mikhail Lobanov <m.lobanov@xxxxxxxxxxxx>
Date:   Thu Sep 12 10:58:39 2024 -0400

    RDMA/cxgb4: Added NULL check for lookup_atid
    
    [ Upstream commit e766e6a92410ca269161de059fff0843b8ddd65f ]
    
    The lookup_atid() function can return NULL if the ATID is
    invalid or does not exist in the identifier table, which
    could lead to dereferencing a null pointer without a
    check in the `act_establish()` and `act_open_rpl()` functions.
    Add a NULL check to prevent null pointer dereferencing.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: cfdda9d76436 ("RDMA/cxgb4: Add driver for Chelsio T4 RNIC")
    Signed-off-by: Mikhail Lobanov <m.lobanov@xxxxxxxxxxxx>
    Link: https://patch.msgid.link/20240912145844.77516-1-m.lobanov@xxxxxxxxxxxx
    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 e8d2135df22db..f9ea863a80885 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -1180,6 +1180,8 @@ static int act_establish(struct c4iw_dev *dev, struct sk_buff *skb)
 	int ret;
 
 	ep = lookup_atid(t, atid);
+	if (!ep)
+		return -EINVAL;
 
 	pr_debug("ep %p tid %u snd_isn %u rcv_isn %u\n", ep, tid,
 		 be32_to_cpu(req->snd_isn), be32_to_cpu(req->rcv_isn));
@@ -2235,6 +2237,9 @@ static int act_open_rpl(struct c4iw_dev *dev, struct sk_buff *skb)
 	int ret = 0;
 
 	ep = lookup_atid(t, atid);
+	if (!ep)
+		return -EINVAL;
+
 	la = (struct sockaddr_in *)&ep->com.local_addr;
 	ra = (struct sockaddr_in *)&ep->com.remote_addr;
 	la6 = (struct sockaddr_in6 *)&ep->com.local_addr;




[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