summaryrefslogtreecommitdiffstats
path: root/drivers/char/ipmi
diff options
context:
space:
mode:
authorTony Camuso <tcamuso@redhat.com>2019-04-09 15:20:03 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-16 19:41:23 +0200
commit9e4fd5e0b81a8f963b1636b19c964ad9d0d3b36e (patch)
tree08a56ec68496d3ddb0a89ccc773698f8df40e2a0 /drivers/char/ipmi
parent7d4d8683e9251254b33497f3eeb8035ecdc11e32 (diff)
downloadlinux-stable-9e4fd5e0b81a8f963b1636b19c964ad9d0d3b36e.tar.gz
linux-stable-9e4fd5e0b81a8f963b1636b19c964ad9d0d3b36e.tar.bz2
linux-stable-9e4fd5e0b81a8f963b1636b19c964ad9d0d3b36e.zip
ipmi: ipmi_si_hardcode.c: init si_type array to fix a crash
[ Upstream commit a885bcfd152f97b25005298ab2d6b741aed9b49c ] The intended behavior of function ipmi_hardcode_init_one() is to default to kcs interface when no type argument is presented when initializing ipmi with hard coded addresses. However, the array of char pointers allocated on the stack by function ipmi_hardcode_init() was not inited to zeroes, so it contained stack debris. Consequently, passing the cruft stored in this array to function ipmi_hardcode_init_one() caused a crash when it was unable to detect that the char * being passed was nonsense and tried to access the address specified by the bogus pointer. The fix is simply to initialize the si_type array to zeroes, so if there were no type argument given to at the command line, function ipmi_hardcode_init_one() could properly default to the kcs interface. Signed-off-by: Tony Camuso <tcamuso@redhat.com> Message-Id: <1554837603-40299-1-git-send-email-tcamuso@redhat.com> Signed-off-by: Corey Minyard <cminyard@mvista.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/char/ipmi')
-rw-r--r--drivers/char/ipmi/ipmi_si_hardcode.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/char/ipmi/ipmi_si_hardcode.c b/drivers/char/ipmi/ipmi_si_hardcode.c
index 9ae2405c28bb..0c28e872ad3a 100644
--- a/drivers/char/ipmi/ipmi_si_hardcode.c
+++ b/drivers/char/ipmi/ipmi_si_hardcode.c
@@ -200,6 +200,8 @@ void __init ipmi_hardcode_init(void)
char *str;
char *si_type[SI_MAX_PARMS];
+ memset(si_type, 0, sizeof(si_type));
+
/* Parse out the si_type string into its components. */
str = si_type_str;
if (*str != '\0') {