diff mbox

ipmi_si: fix crash on parisc

Message ID alpine.LRH.2.02.1712060052170.12854@file01.intranet.prod.int.rdu2.redhat.com (mailing list archive)
State Awaiting Upstream, archived
Headers show

Commit Message

Mikulas Patocka Dec. 6, 2017, 9:25 a.m. UTC
This patch fixes ipmi crash on parisc introduced in the kernel 4.15-rc.
The pointer io.io_setup is not initialized and thus it causes crash in
try_smi_init when attempting to call new_smi->io.io_setup.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
 drivers/char/ipmi/ipmi_si_parisc.c |    2 ++
 1 file changed, 2 insertions(+)

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

Comments

Rolf Eike Beer Dec. 6, 2017, 10:59 a.m. UTC | #1
Mikulas Patocka wrote:
> This patch fixes ipmi crash on parisc introduced in the kernel 4.15-rc.
> The pointer io.io_setup is not initialized and thus it causes crash in
> try_smi_init when attempting to call new_smi->io.io_setup.
> 
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> 
> ---
>  drivers/char/ipmi/ipmi_si_parisc.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> Index: linux-4.15-rc2/drivers/char/ipmi/ipmi_si_parisc.c
> ===================================================================
> --- linux-4.15-rc2.orig/drivers/char/ipmi/ipmi_si_parisc.c	2017-12-06
> 01:19:49.000000000 +0100
> +++ linux-4.15-rc2/drivers/char/ipmi/ipmi_si_parisc.c	2017-12-06
> 06:40:12.000000000 +0100
> @@ -10,6 +10,8 @@ static int __init ipmi_parisc_probe(stru
>  {
>  	struct si_sm_io io;
> 
> +	memset(&io, 0, sizeof(io));
> +
>  	io.si_type	= SI_KCS;
>  	io.addr_source	= SI_DEVICETREE;
>  	io.addr_type	= IPMI_MEM_ADDR_SPACE;

Can't this be a C99 initializer for the whole struct? AFAIK this would 
set all remaining members to 0 anyway.

Eike
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Corey Minyard Dec. 6, 2017, 1:19 p.m. UTC | #2
On 12/06/2017 03:25 AM, Mikulas Patocka wrote:
> This patch fixes ipmi crash on parisc introduced in the kernel 4.15-rc.
> The pointer io.io_setup is not initialized and thus it causes crash in
> try_smi_init when attempting to call new_smi->io.io_setup.

Thanks, I'll get this in for 4.15.

-corey

> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
>
> ---
>   drivers/char/ipmi/ipmi_si_parisc.c |    2 ++
>   1 file changed, 2 insertions(+)
>
> Index: linux-4.15-rc2/drivers/char/ipmi/ipmi_si_parisc.c
> ===================================================================
> --- linux-4.15-rc2.orig/drivers/char/ipmi/ipmi_si_parisc.c	2017-12-06 01:19:49.000000000 +0100
> +++ linux-4.15-rc2/drivers/char/ipmi/ipmi_si_parisc.c	2017-12-06 06:40:12.000000000 +0100
> @@ -10,6 +10,8 @@ static int __init ipmi_parisc_probe(stru
>   {
>   	struct si_sm_io io;
>   
> +	memset(&io, 0, sizeof(io));
> +
>   	io.si_type	= SI_KCS;
>   	io.addr_source	= SI_DEVICETREE;
>   	io.addr_type	= IPMI_MEM_ADDR_SPACE;


--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mikulas Patocka Dec. 6, 2017, 4:08 p.m. UTC | #3
On Wed, 6 Dec 2017, Rolf Eike Beer wrote:

> Mikulas Patocka wrote:
> > This patch fixes ipmi crash on parisc introduced in the kernel 4.15-rc.
> > The pointer io.io_setup is not initialized and thus it causes crash in
> > try_smi_init when attempting to call new_smi->io.io_setup.
> > 
> > Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> > 
> > ---
> >  drivers/char/ipmi/ipmi_si_parisc.c |    2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > Index: linux-4.15-rc2/drivers/char/ipmi/ipmi_si_parisc.c
> > ===================================================================
> > --- linux-4.15-rc2.orig/drivers/char/ipmi/ipmi_si_parisc.c	2017-12-06
> > 01:19:49.000000000 +0100
> > +++ linux-4.15-rc2/drivers/char/ipmi/ipmi_si_parisc.c	2017-12-06
> > 06:40:12.000000000 +0100
> > @@ -10,6 +10,8 @@ static int __init ipmi_parisc_probe(stru
> >  {
> >  	struct si_sm_io io;
> > 
> > +	memset(&io, 0, sizeof(io));
> > +
> >  	io.si_type	= SI_KCS;
> >  	io.addr_source	= SI_DEVICETREE;
> >  	io.addr_type	= IPMI_MEM_ADDR_SPACE;
> 
> Can't this be a C99 initializer for the whole struct? AFAIK this would set all
> remaining members to 0 anyway.
> 
> Eike

It can - but all the other functions that call ipmi_si_add_smi also use 
memset.

Mikulas
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

Index: linux-4.15-rc2/drivers/char/ipmi/ipmi_si_parisc.c
===================================================================
--- linux-4.15-rc2.orig/drivers/char/ipmi/ipmi_si_parisc.c	2017-12-06 01:19:49.000000000 +0100
+++ linux-4.15-rc2/drivers/char/ipmi/ipmi_si_parisc.c	2017-12-06 06:40:12.000000000 +0100
@@ -10,6 +10,8 @@  static int __init ipmi_parisc_probe(stru
 {
 	struct si_sm_io io;
 
+	memset(&io, 0, sizeof(io));
+
 	io.si_type	= SI_KCS;
 	io.addr_source	= SI_DEVICETREE;
 	io.addr_type	= IPMI_MEM_ADDR_SPACE;