mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+abbfd103085885cf16a2@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [usb?] KASAN: slab-out-of-bounds Read in usbtmc_interrupt
Date: Sun, 17 Aug 2025 12:11:51 +0800	[thread overview]
Message-ID: <20250817041202.4853-1-hdanton@sina.com> (raw)
In-Reply-To: <689ff5f6.050a0220.e29e5.0032.GAE@google.com>

> Date: Fri, 15 Aug 2025 20:07:34 -0700	[thread overview]
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    931e46dcbc7e Add linux-next specific files for 20250814
> git tree:       linux-next
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=11ef65a2580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=bb7fbecfa2364d1c
> dashboard link: https://syzkaller.appspot.com/bug?extid=abbfd103085885cf16a2
> compiler:       Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=14a99842580000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=17108da2580000

#syz test

--- x/fs/smb/server/transport_rdma.h
+++ y/fs/smb/server/transport_rdma.h
@@ -61,7 +61,7 @@ void init_smbd_max_io_size(unsigned int
 unsigned int get_smbd_max_read_write_size(void);
 #else
 static inline int ksmbd_rdma_init(void) { return 0; }
-static inline void ksmbd_rdma_stop_listening(void) { return };
+static inline void ksmbd_rdma_stop_listening(void) { }
 static inline void ksmbd_rdma_destroy(void) { return; }
 static inline bool ksmbd_rdma_capable_netdev(struct net_device *netdev) { return false; }
 static inline void init_smbd_max_io_size(unsigned int sz) { }
--- x/drivers/usb/class/usbtmc.c
+++ y/drivers/usb/class/usbtmc.c
@@ -107,6 +107,7 @@ struct usbtmc_device_data {
 	struct usbtmc_dev_capabilities	capabilities;
 	struct kref kref;
 	struct mutex io_mutex;	/* only one i/o function running at a time */
+	atomic_t inflight, deinit;
 	wait_queue_head_t waitq;
 	struct fasync_struct *fasync;
 	spinlock_t dev_lock; /* lock for file_list */
@@ -2352,19 +2353,29 @@ static void usbtmc_interrupt(struct urb
 	default:
 		/* urb terminated, clean up */
 		dev_dbg(dev, "urb terminated, status: %d\n", status);
+		atomic_dec(&data->inflight);
 		return;
 	}
 exit:
+	if (atomic_read(&data->deinit)) {
+		atomic_dec(&data->inflight);
+		return;
+	}
 	rv = usb_submit_urb(urb, GFP_ATOMIC);
-	if (rv)
+	if (rv) {
+		atomic_dec(&data->inflight);
 		dev_err(dev, "usb_submit_urb failed: %d\n", rv);
+	}
 }
 
 static void usbtmc_free_int(struct usbtmc_device_data *data)
 {
 	if (!data->iin_ep_present || !data->iin_urb)
 		return;
+	atomic_inc(&data->deinit);
 	usb_kill_urb(data->iin_urb);
+	while (atomic_read(&data->inflight))
+		schedule_timeout_idle(1);
 	kfree(data->iin_buffer);
 	data->iin_buffer = NULL;
 	usb_free_urb(data->iin_urb);
@@ -2467,8 +2478,10 @@ static int usbtmc_probe(struct usb_inter
 				usbtmc_interrupt,
 				data, data->iin_interval);
 
+		atomic_inc(&data->inflight);
 		retcode = usb_submit_urb(data->iin_urb, GFP_KERNEL);
 		if (retcode) {
+			atomic_dec(&data->inflight);
 			dev_err(&intf->dev, "Failed to submit iin_urb\n");
 			goto error_register;
 		}
--

  parent reply	other threads:[~2025-08-17  4:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-16  3:07 syzbot
2025-08-16  5:18 ` Hillf Danton
2025-08-16  5:43   ` syzbot
2025-08-17  2:08 ` Hillf Danton
2025-08-17  2:33   ` syzbot
2025-08-17  2:49 ` Hillf Danton
2025-08-17  3:19   ` syzbot
2025-08-17  4:11 ` Hillf Danton [this message]
2025-08-17  4:33   ` syzbot
2025-08-17  5:00 ` Hillf Danton
2025-08-17  5:30   ` syzbot
2025-08-17  6:07 ` Hillf Danton
2025-08-17  6:56   ` syzbot
2026-04-22 21:34 ` Forwarded: " syzbot
     [not found] <DI008TGYCSA0.3QEIHIYB94YEK@igalia.com>
2026-04-22 22:15 ` syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250817041202.4853-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+abbfd103085885cf16a2@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®