public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+cf1afeda4043ffecf03e@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [usb?] [fs?] KASAN: slab-use-after-free Read in comedi_release_hardware_device
Date: Wed,  7 Feb 2024 19:34:05 +0800	[thread overview]
Message-ID: <20240207113405.999-1-hdanton@sina.com> (raw)
In-Reply-To: <0000000000008eec060610c6b378@google.com>

On Wed, 07 Feb 2024 00:44:22 -0800
> HEAD commit:    ed5551279c91 Merge 6.8-rc3 into usb-next
> git tree:       https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=10d42d8fe80000

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git  usb-testing

--- x/drivers/comedi/drivers.c
+++ y/drivers/comedi/drivers.c
@@ -1034,6 +1034,7 @@ int comedi_auto_config(struct device *ha
 {
 	struct comedi_device *dev;
 	int ret;
+	static DEFINE_MUTEX(ac_mutex);
 
 	if (!hardware_device) {
 		pr_warn("BUG! %s called with NULL hardware_device\n", __func__);
@@ -1051,12 +1052,14 @@ int comedi_auto_config(struct device *ha
 			 driver->driver_name);
 		return -EINVAL;
 	}
+	mutex_lock(&ac_mutex);
 
 	dev = comedi_alloc_board_minor(hardware_device);
 	if (IS_ERR(dev)) {
 		dev_warn(hardware_device,
 			 "driver '%s' could not create device.\n",
 			 driver->driver_name);
+		mutex_unlock(&ac_mutex);
 		return PTR_ERR(dev);
 	}
 	/* Note: comedi_alloc_board_minor() locked dev->mutex. */
@@ -1084,6 +1087,7 @@ int comedi_auto_config(struct device *ha
 			 driver->driver_name, dev->board_name);
 		mutex_unlock(&dev->mutex);
 	}
+	mutex_unlock(&ac_mutex);
 	return ret;
 }
 EXPORT_SYMBOL_GPL(comedi_auto_config);
--

  reply	other threads:[~2024-02-07 11:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-07  8:44 [syzbot] [usb?] [fs?] KASAN: slab-use-after-free Read in comedi_release_hardware_device syzbot
2024-02-07 11:34 ` Hillf Danton [this message]
2024-02-07 11:52   ` 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=20240207113405.999-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+cf1afeda4043ffecf03e@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