]> git.baikalelectronics.ru Git - kernel.git/commit
net/smc: fix access to parent of an ib device
authorKarsten Graul <kgraul@linux.ibm.com>
Tue, 15 Dec 2020 09:10:58 +0000 (10:10 +0100)
committerJakub Kicinski <kuba@kernel.org>
Wed, 16 Dec 2020 21:33:47 +0000 (13:33 -0800)
commit7ec0ff77089952e665e74f8992e9b7373de5c5f5
treec36a689ee34bb11dba06e8769634f91da527ebfb
parent66e275af098772c03c76c8b0e831cdb25accb212
net/smc: fix access to parent of an ib device

The parent of an ib device is used to retrieve the PCI device
attributes. It turns out that there are possible cases when an ib device
has no parent set in the device structure, which may lead to page
faults when trying to access this memory.
Fix that by checking the parent pointer and consolidate the pci device
specific processing in a new function.

Fixes: d2ae1389288b ("net/smc: Add support for obtaining SMCR device list")
Reported-by: syzbot+600fef7c414ee7e2d71b@syzkaller.appspotmail.com
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Link: https://lore.kernel.org/r/20201215091058.49354-2-kgraul@linux.ibm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/smc/smc_ib.c