linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ricardo B. Marliere" <ricardo@marliere.net>
To: syzbot <syzbot+621409285c4156a009b3@syzkaller.appspotmail.com>
Cc: isely@pobox.com, linux-kernel@vger.kernel.org,
	linux-media@vger.kernel.org, linux-usb@vger.kernel.org,
	mchehab@kernel.org, pvrusb2@isely.net,
	syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [pvrusb2?] [usb?] KASAN: slab-use-after-free Read in pvr2_context_set_notify
Date: Wed, 27 Sep 2023 11:37:20 -0300	[thread overview]
Message-ID: <gugiuvjgpoogf3k5cm4px4jwevg5torsu3d7afbbhvnrxho4zu@wkcxeb5sr5ez> (raw)
In-Reply-To: <000000000000a02a4205fff8eb92@google.com>

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

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

[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 970 bytes --]

diff --git a/drivers/media/usb/pvrusb2/pvrusb2-context.c b/drivers/media/usb/pvrusb2/pvrusb2-context.c
index 14170a5d72b3..e3356f94e50e 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-context.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-context.c
@@ -27,9 +27,16 @@ static int pvr2_context_cleaned_flag;
 static struct task_struct *pvr2_context_thread_ptr;
 
 
+static int pvr2_context_shutok(void)
+{
+	return pvr2_context_cleanup_flag && (pvr2_context_exist_first == NULL);
+}
+
+
 static void pvr2_context_set_notify(struct pvr2_context *mp, int fl)
 {
 	int signal_flag = 0;
+	if (pvr2_context_shutok()) return;
 	mutex_lock(&pvr2_context_mutex);
 	if (fl) {
 		if (!mp->notify_flag) {
@@ -140,12 +147,6 @@ static void pvr2_context_check(struct pvr2_context *mp)
 }
 
 
-static int pvr2_context_shutok(void)
-{
-	return pvr2_context_cleanup_flag && (pvr2_context_exist_first == NULL);
-}
-
-
 static int pvr2_context_thread_func(void *foo)
 {
 	struct pvr2_context *mp;

  reply	other threads:[~2023-09-27 14:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-08 12:30 [syzbot] [pvrusb2?] [usb?] KASAN: slab-use-after-free Read in pvr2_context_set_notify syzbot
2023-09-27 14:37 ` Ricardo B. Marliere [this message]
2023-09-27 14:55   ` [syzbot] [pvrusb2?] " syzbot
     [not found]     ` <20230928112020.1277-1-hdanton@sina.com>
2023-09-28 11:36       ` syzbot
2023-09-28 12:17       ` Ricardo B. Marliere
2023-10-06 12:17   ` [syzbot] [pvrusb2?] [usb?] " Ricardo B. Marliere
2023-10-06 12:42     ` [syzbot] [pvrusb2?] " syzbot
2023-10-12 22:07   ` [syzbot] [pvrusb2?] [usb?] " Ricardo B. Marliere
2023-10-12 22:54     ` [syzbot] [usb?] [pvrusb2?] " 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=gugiuvjgpoogf3k5cm4px4jwevg5torsu3d7afbbhvnrxho4zu@wkcxeb5sr5ez \
    --to=ricardo@marliere.net \
    --cc=isely@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=pvrusb2@isely.net \
    --cc=syzbot+621409285c4156a009b3@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;
as well as URLs for NNTP newsgroup(s).