diff options
author | Karsten Graul <kgraul@linux.ibm.com> | 2020-02-26 19:52:46 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-03-18 09:14:25 +0300 |
commit | a22af440349cfa38243ef50c915e0a5a4de59702 (patch) | |
tree | aa48ca6b1e28a601aab024a302b2f6ffeb100ff5 /net | |
parent | b5b9c644cfc2547af1bf2f382b9b547a7b33a614 (diff) | |
download | linux-a22af440349cfa38243ef50c915e0a5a4de59702.tar.xz |
net/smc: check for valid ib_client_data
commit a2f2ef4a54c0d97aa6a8386f4ff23f36ebb488cf upstream.
In smc_ib_remove_dev() check if the provided ib device was actually
initialized for SMC before.
Reported-by: syzbot+84484ccebdd4e5451d91@syzkaller.appspotmail.com
Fixes: a4cf0443c414 ("smc: introduce SMC as an IB-client")
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/smc/smc_ib.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/smc/smc_ib.c b/net/smc/smc_ib.c index e519ef29c0ff..ca505ff5b5bb 100644 --- a/net/smc/smc_ib.c +++ b/net/smc/smc_ib.c @@ -552,6 +552,8 @@ static void smc_ib_remove_dev(struct ib_device *ibdev, void *client_data) struct smc_ib_device *smcibdev; smcibdev = ib_get_client_data(ibdev, &smc_ib_client); + if (!smcibdev || smcibdev->ibdev != ibdev) + return; ib_set_client_data(ibdev, &smc_ib_client, NULL); spin_lock(&smc_ib_devices.lock); list_del_init(&smcibdev->list); /* remove from smc_ib_devices */ |