From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+d0f14b2d5a3d1587fbe7@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [pvrusb2?] [usb?] KASAN: slab-use-after-free Read in pvr2_context_set_notify (3)
Date: Sun, 14 Apr 2024 19:09:52 +0800 [thread overview]
Message-ID: <20240414110952.2437-1-hdanton@sina.com> (raw)
In-Reply-To: <000000000000bb465d061606e827@google.com>
On Sat, 13 Apr 2024 21:26:30 -0700
> syzbot found the following issue on:
>
> HEAD commit: a788e53c05ae usb: usb-acpi: Fix oops due to freeing uninit..
> git tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=120ca915180000
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
--- x/drivers/media/usb/pvrusb2/pvrusb2-context.c
+++ y/drivers/media/usb/pvrusb2/pvrusb2-context.c
@@ -26,6 +26,8 @@ static int pvr2_context_cleanup_flag;
static int pvr2_context_cleaned_flag;
static struct task_struct *pvr2_context_thread_ptr;
+static DEFINE_MUTEX(pvr2_disconn_mutex);
+static int pvr2_context_cleaning;
static void pvr2_context_set_notify(struct pvr2_context *mp, int fl)
{
@@ -152,6 +154,9 @@ static int pvr2_context_thread_func(void
pvr2_trace(PVR2_TRACE_CTXT,"pvr2_context thread start");
+ mutex_lock(&pvr2_disconn_mutex);
+ pvr2_context_cleaning = 1;
+ mutex_unlock(&pvr2_disconn_mutex);
do {
while ((mp = pvr2_context_notify_first) != NULL) {
pvr2_context_set_notify(mp, 0);
@@ -163,6 +168,9 @@ static int pvr2_context_thread_func(void
pvr2_context_shutok()));
} while (!pvr2_context_shutok());
+ mutex_lock(&pvr2_disconn_mutex);
+ pvr2_context_cleaning = 0;
+ mutex_unlock(&pvr2_disconn_mutex);
pvr2_context_cleaned_flag = !0;
wake_up(&pvr2_context_cleanup_data);
@@ -266,13 +274,17 @@ static void pvr2_context_exit(struct pvr
void pvr2_context_disconnect(struct pvr2_context *mp)
{
+ mutex_lock(&pvr2_disconn_mutex);
+ if (pvr2_context_cleaning)
+ goto out;
pvr2_hdw_disconnect(mp->hdw);
if (!pvr2_context_shutok())
pvr2_context_notify(mp);
mp->disconnect_flag = !0;
+out:
+ mutex_unlock(&pvr2_disconn_mutex);
}
-
void pvr2_channel_init(struct pvr2_channel *cp,struct pvr2_context *mp)
{
pvr2_context_enter(mp);
--
next prev parent reply other threads:[~2024-04-14 11:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-14 4:26 syzbot
2024-04-14 9:02 ` Hillf Danton
2024-04-14 9:30 ` syzbot
2024-04-14 9:37 ` [syzbot] [pvrusb2?] KASAN: slab-use-after-free Read in pvr2_context_set_notify (2) Edward Adam Davis
2024-04-14 9:53 ` [syzbot] [pvrusb2?] [usb?] KASAN: slab-use-after-free Read in pvr2_context_set_notify (3) syzbot
2024-04-14 11:09 ` Hillf Danton [this message]
2024-04-14 11:27 ` syzbot
2024-04-14 12:58 ` [syzbot] [pvrusb2?] KASAN: slab-use-after-free Read in pvr2_context_set_notify (2) Edward Adam Davis
2024-04-14 13:21 ` [syzbot] [pvrusb2?] [usb?] KASAN: slab-use-after-free Read in pvr2_context_set_notify (3) 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=20240414110952.2437-1-hdanton@sina.com \
--to=hdanton@sina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+d0f14b2d5a3d1587fbe7@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®