Patch "net/smc: Fix NULL pointer dereference in smc_pnet_find_ib()" has been added to the 5.17-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

    net/smc: Fix NULL pointer dereference in smc_pnet_find_ib()

to the 5.17-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:
     net-smc-fix-null-pointer-dereference-in-smc_pnet_fin.patch
and it can be found in the queue-5.17 subdirectory.

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



commit 207b53ea97363f031e442646ad43c065ff0a24a7
Author: Karsten Graul <kgraul@xxxxxxxxxxxxx>
Date:   Fri Apr 8 17:10:34 2022 +0200

    net/smc: Fix NULL pointer dereference in smc_pnet_find_ib()
    
    [ Upstream commit d22f4f977236f97e01255a80bca2ea93a8094fc8 ]
    
    dev_name() was called with dev.parent as argument but without to
    NULL-check it before.
    Solve this by checking the pointer before the call to dev_name().
    
    Fixes: af5f60c7e3d5 ("net/smc: allow PCI IDs as ib device names in the pnet table")
    Reported-by: syzbot+03e3e228510223dabd34@xxxxxxxxxxxxxxxxxxxxxxxxx
    Signed-off-by: Karsten Graul <kgraul@xxxxxxxxxxxxx>
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/smc/smc_pnet.c b/net/smc/smc_pnet.c
index 29f0a559d884..4769f76505af 100644
--- a/net/smc/smc_pnet.c
+++ b/net/smc/smc_pnet.c
@@ -311,8 +311,9 @@ static struct smc_ib_device *smc_pnet_find_ib(char *ib_name)
 	list_for_each_entry(ibdev, &smc_ib_devices.list, list) {
 		if (!strncmp(ibdev->ibdev->name, ib_name,
 			     sizeof(ibdev->ibdev->name)) ||
-		    !strncmp(dev_name(ibdev->ibdev->dev.parent), ib_name,
-			     IB_DEVICE_NAME_MAX - 1)) {
+		    (ibdev->ibdev->dev.parent &&
+		     !strncmp(dev_name(ibdev->ibdev->dev.parent), ib_name,
+			     IB_DEVICE_NAME_MAX - 1))) {
 			goto out;
 		}
 	}



[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