net/smc: Fix NULL pointer dereference in smc_pnet_find_ib()
authorKarsten Graul <kgraul@linux.ibm.com>
Fri, 8 Apr 2022 15:10:34 +0000 (17:10 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Apr 2022 07:34:11 +0000 (09:34 +0200)
commit3a523807f01455fe9a0c1a433f27cd4411ee400f
tree3f534295ef3e9852afd54671186c65945b37a840
parent66b3107a4a0615decc7e9bfc4352a067380d3224
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@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>
net/smc/smc_pnet.c