public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: fix WARNING in pvr2_i2c_core_done
@ 2020-07-21 11:10 B K Karthik
  2020-07-21 11:20 ` syzbot
  0 siblings, 1 reply; 3+ messages in thread
From: B K Karthik @ 2020-07-21 11:10 UTC (permalink / raw)
  To: syzbot+e74a998ca8f1df9cc332, syzkaller-bugs, gregkh, skhan,
	Dan Carpenter, Mike Isely, Mauro Carvalho Chehab, linux-media,
	linux-i2c, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1090 bytes --]

#syz test: https://github.com/google/kasan.git usb-fuzzer

fix WARNING in pvr2_i2c_core_done by
unregistering device in the release handler
instead of the disconnect handler.

Reported-by: syzbot+e74a998ca8f1df9cc332@syzkaller.appspotmail.com
Signed-off-by: B K Karthik <bkkarthik@pesu.pes.edu>
---
 drivers/i2c/i2c-core-base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index 26f03a14a478..2d377d2e89f1 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -462,6 +462,7 @@ static void i2c_device_shutdown(struct device *dev)
 
 static void i2c_client_dev_release(struct device *dev)
 {
+	i2c_unregister_device(to_i2c_client(dev));
 	kfree(to_i2c_client(dev));
 }
 
@@ -1527,7 +1528,6 @@ void i2c_del_adapter(struct i2c_adapter *adap)
 		dev_dbg(&adap->dev, "Removing %s at 0x%x\n", client->name,
 			client->addr);
 		list_del(&client->detected);
-		i2c_unregister_device(client);
 	}
 	mutex_unlock(&adap->userspace_clients_lock);
 
-- 
2.20.1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-21 11:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-21 11:10 [PATCH] i2c: fix WARNING in pvr2_i2c_core_done B K Karthik
2020-07-21 11:20 ` syzbot
2020-07-21 11:55   ` B K Karthik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox