Commit a2f2ef4a authored by Karsten Graul's avatar Karsten Graul Committed by David S. Miller
Browse files

net/smc: check for valid ib_client_data



In smc_ib_remove_dev() check if the provided ib device was actually
initialized for SMC before.

Reported-by: default avatar <syzbot+84484ccebdd4e5451d91@syzkaller.appspotmail.com>
Fixes: a4cf0443 ("smc: introduce SMC as an IB-client")
Signed-off-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 474a31e1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -573,6 +573,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 */