Forwarded: [PATCH] configfs: unhash dentry before dropping the item

syzbot posted 1 patch 1 week, 4 days ago
There is a newer version of this series
Forwarded: [PATCH] configfs: unhash dentry before dropping the item
Posted by syzbot 1 week, 4 days ago
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: [PATCH] configfs: unhash dentry before dropping the item
Author: jchuang26@m.fudan.edu.cn

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 762137ff748fa0c920f82ce718163691cb02f907

Reported-by: syzbot+92f5bf49bf4ac75223ca@syzkaller.appspotmail.com

diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index 4266a0cb7..b1b358b3a 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -2458,12 +2458,21 @@ static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf,
 	struct uea_softc *sc;
 	int ret, ifnum = intf->altsetting->desc.bInterfaceNumber;
 	unsigned int alt;
+	int modem_idx;
 
 	/* interface 0 is for firmware/monitoring */
 	if (ifnum != UEA_INTR_IFACE_NO)
 		return -ENODEV;
 
-	usbatm->flags = (sync_wait[modem_index] ? 0 : UDSL_SKIP_HEAVY_INIT);
+	/*
+	 * modem_index is a global counter that stops at NB_MODEM once that
+	 * many devices have been probed. Wrap the index the same way as
+	 * sc->modem_index below so that the module parameter lookup stays
+	 * within the bounds of the arrays.
+	 */
+	modem_idx = (modem_index < NB_MODEM) ? modem_index : 0;
+
+	usbatm->flags = (sync_wait[modem_idx] ? 0 : UDSL_SKIP_HEAVY_INIT);
 
 	/* interface 1 is for outbound traffic */
 	ret = claim_interface(usb, usbatm, UEA_US_IFACE_NO);