Skip to contentSkip to conversation

ipmi_si: Potential array underflow in hotmod_handler()

PATCH In review Dan Carpenter 2 participants 2 messages Feb 22, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipmi_si: Potential array underflow in hotmod_handler()

The "ival" variable needs to signed so that we don't read before the start of the str[] array. This would only happen the user passed in a module parameter that was just comprised of space characters.

Fixes e80444ae4fc3 ("ipmi_si: Switch hotmod to use a platform device")
---
 drivers/char/ipmi/ipmi_si_hotmod.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/ipmi/ipmi_si_hotmod.c +2 -1
index 1433055a9705..03140f6cdf6f 100644
@@ -187,7 +187,8 @@ static int hotmod_handler(const char *val, const struct kernel_param *kp)
 	char *str = kstrdup(val, GFP_KERNEL), *curr, *next;
 	int  rv;
 	struct ipmi_plat_data h;
-	unsigned int len, ival;
+	unsigned int len;
+	int ival;
 
 	if (!str)
 		return -ENOMEM;
Signature · 1 line
2.17.1
#1 lore raw

Re: [PATCH] ipmi_si: Potential array underflow in hotmod_handler()y

Quoted 3 lines · Dan Carpenter

The "ival" variable needs to signed so that we don't read before the start of the str[] array. This would only happen the user passed in a module parameter that was just comprised of space characters.

That was quick, I just uploaded that to linux-next yesterday. Thanks for this, yes you are right. Added to my queue.

-corey

Quoted 24 lines
Fixes e80444ae4fc3 ("ipmi_si: Switch hotmod to use a platform device")
---
 drivers/char/ipmi/ipmi_si_hotmod.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/ipmi/ipmi_si_hotmod.c +2 -1
index 1433055a9705..03140f6cdf6f 100644
@@ -187,7 +187,8 @@ static int hotmod_handler(const char *val, const struct kernel_param *kp)
 	char *str = kstrdup(val, GFP_KERNEL), *curr, *next;
 	int  rv;
 	struct ipmi_plat_data h;
-	unsigned int len, ival;
+	unsigned int len;
+	int ival;
 
 	if (!str)
 		return -ENOMEM;
Signature · 1 line
2.17.1