+ fix-ipmi-watchdog-set_param_str-using-kstrdup.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Fix IPMI watchdog set_param_str() using kstrdup
has been added to the -mm tree.  Its filename is
     fix-ipmi-watchdog-set_param_str-using-kstrdup.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: Fix IPMI watchdog set_param_str() using kstrdup
From: Sebastien Dugué <sebastien.dugue@xxxxxxxx>

set_param_str() cannot use kstrdup() to duplicate the parameter.  That's
fine when the driver is compiled as a module but it sure is not when built
into the kernel as the kernel parameters are parsed before the kmalloc
slabs are setup.

Signed-off-by: Sebastien Dugué <sebastien.dugue@xxxxxxxx>
Cc: Corey Minyard <minyard@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/char/ipmi/ipmi_watchdog.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff -puN drivers/char/ipmi/ipmi_watchdog.c~fix-ipmi-watchdog-set_param_str-using-kstrdup drivers/char/ipmi/ipmi_watchdog.c
--- a/drivers/char/ipmi/ipmi_watchdog.c~fix-ipmi-watchdog-set_param_str-using-kstrdup
+++ a/drivers/char/ipmi/ipmi_watchdog.c
@@ -216,13 +216,13 @@ static int set_param_str(const char *val
 {
 	action_fn  fn = (action_fn) kp->arg;
 	int        rv = 0;
-	char       *dup, *s;
+	char       valcp[16];
+	char       *s;
 
-	dup = kstrdup(val, GFP_KERNEL);
-	if (!dup)
-		return -ENOMEM;
+	strncpy(valcp, val, 16);
+	valcp[15] = '\0';
 
-	s = strstrip(dup);
+	s = strstrip(valcp);
 
 	down_read(&register_sem);
 	rv = fn(s, NULL);
@@ -235,7 +235,6 @@ static int set_param_str(const char *val
 
  out_unlock:
 	up_read(&register_sem);
-	kfree(dup);
 	return rv;
 }
 
_

Patches currently in -mm which might be from sebastien.dugue@xxxxxxxx are

fix-ipmi-watchdog-set_param_str-using-kstrdup.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux