You've already forked linux-rockchip
mirror of
https://github.com/armbian/linux-rockchip.git
synced 2026-01-06 11:08:10 -08:00
net/smc: Fix NULL pointer dereference in smc_pnet_find_ib()
[ Upstream commitd22f4f9772] 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:af5f60c7e3("net/smc: allow PCI IDs as ib device names in the pnet table") Reported-by: syzbot+03e3e228510223dabd34@syzkaller.appspotmail.com Signed-off-by: Karsten Graul <kgraul@linux.ibm.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
98a7f6c4ad
commit
35b91e49bc
@@ -310,8 +310,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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user