]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 May 2021 12:01:53 +0000 (14:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 May 2021 12:01:53 +0000 (14:01 +0200)
added patches:
kobject_uevent-remove-warning-in-init_uevent_argv.patch

queue-4.19/kobject_uevent-remove-warning-in-init_uevent_argv.patch [new file with mode: 0644]
queue-4.19/series

diff --git a/queue-4.19/kobject_uevent-remove-warning-in-init_uevent_argv.patch b/queue-4.19/kobject_uevent-remove-warning-in-init_uevent_argv.patch
new file mode 100644 (file)
index 0000000..5abaca2
--- /dev/null
@@ -0,0 +1,45 @@
+From b4104180a2efb85f55e1ba1407885c9421970338 Mon Sep 17 00:00:00 2001
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Date: Mon, 5 Apr 2021 11:48:52 +0200
+Subject: kobject_uevent: remove warning in init_uevent_argv()
+
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+commit b4104180a2efb85f55e1ba1407885c9421970338 upstream.
+
+syzbot can trigger the WARN() in init_uevent_argv() which isn't the
+nicest as the code does properly recover and handle the error.  So
+change the WARN() call to pr_warn() and provide some more information on
+what the buffer size that was needed.
+
+Link: https://lore.kernel.org/r/20201107082206.GA19079@kroah.com
+Cc: "Rafael J. Wysocki" <rafael@kernel.org>
+Cc: linux-kernel@vger.kernel.org
+Reported-by: syzbot+92340f7b2b4789907fdb@syzkaller.appspotmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Link: https://lore.kernel.org/r/20210405094852.1348499-1-gregkh@linuxfoundation.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ lib/kobject_uevent.c |    9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+--- a/lib/kobject_uevent.c
++++ b/lib/kobject_uevent.c
+@@ -250,12 +250,13 @@ static int kobj_usermode_filter(struct k
+ static int init_uevent_argv(struct kobj_uevent_env *env, const char *subsystem)
+ {
++      int buffer_size = sizeof(env->buf) - env->buflen;
+       int len;
+-      len = strlcpy(&env->buf[env->buflen], subsystem,
+-                    sizeof(env->buf) - env->buflen);
+-      if (len >= (sizeof(env->buf) - env->buflen)) {
+-              WARN(1, KERN_ERR "init_uevent_argv: buffer size too small\n");
++      len = strlcpy(&env->buf[env->buflen], subsystem, buffer_size);
++      if (len >= buffer_size) {
++              pr_warn("init_uevent_argv: buffer size of %d too small, needed %d\n",
++                      buffer_size, len);
+               return -ENOMEM;
+       }
index d807463cc873f18ded52f93731f53471b3f15908..48f57c2d34eeea29c65222dd237def63710e7cf0 100644 (file)
@@ -388,3 +388,4 @@ mips-reinstate-platform-__div64_32-handler.patch
 mips-avoid-divu-in-__div64_32-is-result-would-be-zero.patch
 mips-avoid-handcoded-divu-in-__div64_32-altogether.patch
 thermal-core-fair-share-lock-the-thermal-zone-while-looping-over-instances.patch
+kobject_uevent-remove-warning-in-init_uevent_argv.patch