public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+ace60642828c074eb913@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [syzbot] Re: [syzbot] [pm?] possible deadlock in lock_system_sleep
Date: Thu, 20 Feb 2025 18:57:32 -0800	[thread overview]
Message-ID: <67b7eb9c.050a0220.14d86d.0309.GAE@google.com> (raw)
In-Reply-To: <67b74749.050a0220.14d86d.02b4.GAE@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Re: [syzbot] [pm?] possible deadlock in lock_system_sleep
Author: lizhi.xu@windriver.com

#syz test

diff --git a/kernel/params.c b/kernel/params.c
index 0074d29c9b80..d19881fbb2ec 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -583,7 +583,9 @@ static ssize_t param_attr_store(const struct module_attribute *mattr,
 	if (!attribute->param->ops->set)
 		return -EPERM;
 
-	kernel_param_lock(mk->mod);
+	if (!kernel_param_trylock(mk->mod))
+		return -EPERM;
+
 	if (param_check_unsafe(attribute->param))
 		err = attribute->param->ops->set(buf, attribute->param);
 	else
@@ -607,6 +609,11 @@ void kernel_param_lock(struct module *mod)
 	mutex_lock(KPARAM_MUTEX(mod));
 }
 
+int kernel_param_trylock(struct module *mod)
+{
+	return mutex_trylock(KPARAM_MUTEX(mod));
+}
+
 void kernel_param_unlock(struct module *mod)
 {
 	mutex_unlock(KPARAM_MUTEX(mod));
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index bfb85fd13e1f..cbcbfd8db721 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -306,11 +306,15 @@ struct kparam_array
 
 #ifdef CONFIG_SYSFS
 extern void kernel_param_lock(struct module *mod);
+extern int kernel_param_trylock(struct module *mod);
 extern void kernel_param_unlock(struct module *mod);
 #else
 static inline void kernel_param_lock(struct module *mod)
 {
 }
+static inline int kernel_param_trylock(struct module *mod)
+{
+}
 static inline void kernel_param_unlock(struct module *mod)
 {
 }

  parent reply	other threads:[~2025-02-21  2:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-20 15:16 [syzbot] [pm?] possible deadlock in lock_system_sleep syzbot
2025-02-21  1:45 ` [syzbot] " syzbot
2025-02-21  2:57 ` syzbot [this message]
2025-02-21  6:27 ` syzbot
2025-02-21 10:10 ` [PATCH] module: replace the mutex lock acquisition method Lizhi Xu
2025-02-21 11:41   ` Rafael J. Wysocki
2025-02-21 12:32     ` Lizhi Xu
2025-02-21 12:35     ` [PATCH V2] " Lizhi Xu
2025-02-21 20:07       ` Rafael J. Wysocki
2025-02-22  1:02         ` [PATCH] " Lizhi Xu
2025-02-22  4:45         ` [PATCH V3] " Lizhi Xu
2025-02-23 13:01           ` Rafael J. Wysocki
2025-02-24  1:31             ` [PATCH V4] " Lizhi Xu
2025-02-26 15:01               ` Rafael J. Wysocki

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=67b7eb9c.050a0220.14d86d.0309.GAE@google.com \
    --to=syzbot+ace60642828c074eb913@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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