]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
another param bugfix added
authorGreg Kroah-Hartman <gregkh@suse.de>
Fri, 16 Nov 2007 00:12:56 +0000 (16:12 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 16 Nov 2007 00:12:56 +0000 (16:12 -0800)
review-2.6.23-1/fix-param_sysfs_builtin-name-length-check.patch [new file with mode: 0644]
review-2.6.23-1/series

diff --git a/review-2.6.23-1/fix-param_sysfs_builtin-name-length-check.patch b/review-2.6.23-1/fix-param_sysfs_builtin-name-length-check.patch
new file mode 100644 (file)
index 0000000..b52f40a
--- /dev/null
@@ -0,0 +1,54 @@
+From 22800a2830ec07e7cc5c837999890ac47cc7f5de Mon Sep 17 00:00:00 2001
+From: Jan Kiszka <jan.kiszka@web.de>
+Date: Wed, 14 Nov 2007 17:00:08 -0800
+Subject: [PATCH] fix param_sysfs_builtin name length check
+
+From: Jan Kiszka <jan.kiszka@web.de>
+
+patch 22800a2830ec07e7cc5c837999890ac47cc7f5de in mainline.
+
+Commit faf8c714f4508207a9c81cc94dafc76ed6680b44 caused a regression:
+parameter names longer than MAX_KBUILD_MODNAME will now be rejected,
+although we just need to keep the module name part that short.  This patch
+restores the old behaviour while still avoiding that memchr is called with
+its length parameter larger than the total string length.
+
+Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
+Cc: Dave Young <hidave.darkstar@gmail.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Chuck Ebbert <cebbert@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ kernel/params.c |   15 ++++++---------
+ 1 file changed, 6 insertions(+), 9 deletions(-)
+
+--- a/kernel/params.c
++++ b/kernel/params.c
+@@ -595,19 +595,16 @@ static void __init param_sysfs_builtin(v
+       for (i=0; i < __stop___param - __start___param; i++) {
+               char *dot;
+-              size_t kplen;
++              size_t max_name_len;
+               kp = &__start___param[i];
+-              kplen = strlen(kp->name);
++              max_name_len =
++                      min_t(size_t, MAX_KBUILD_MODNAME, strlen(kp->name));
+-              /* We do not handle args without periods. */
+-              if (kplen > MAX_KBUILD_MODNAME) {
+-                      DEBUGP("kernel parameter name is too long: %s\n", kp->name);
+-                      continue;
+-              }
+-              dot = memchr(kp->name, '.', kplen);
++              dot = memchr(kp->name, '.', max_name_len);
+               if (!dot) {
+-                      DEBUGP("couldn't find period in %s\n", kp->name);
++                      DEBUGP("couldn't find period in first %d characters "
++                             "of %s\n", MAX_KBUILD_MODNAME, kp->name);
+                       continue;
+               }
+               name_len = dot - kp->name;
index 4c6c15258c8c68c820ea8c94ce223bc42cbd0c96..2b54dfdd2cc6437f809eb99e6bf1e36480088464 100644 (file)
@@ -3,6 +3,7 @@ lockdep-fix-mismatched-lockdep_depth-curr_chain_hash.patch
 locks-fix-possible-infinite-loop-in-posix-deadlock-detection.patch
 remove-broken-ptrace-special-case-code-from-file-mapping.patch
 param_sysfs_builtin-memchr-argument-fix.patch
+fix-param_sysfs_builtin-name-length-check.patch
 howto-update-ja_jp-howto-with-latest-changes.patch
 slub-fix-memory-leak-by-not-reusing-cpu_slab.patch
 writeback-don-t-propagate-aop_writepage_activate.patch