linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipmi: fix oob access due to uninit smi_msg type
@ 2021-11-24 21:03 Jakub Kicinski
  2021-11-25 14:21 ` Corey Minyard
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2021-11-24 21:03 UTC (permalink / raw)
  To: minyard, andrew.manley
  Cc: openipmi-developer, linux-kernel, kernel-team, Jakub Kicinski

We're hitting OOB accesses in handle_ipmb_direct_rcv_rsp() (memcpy of
size -1) after user space generates a message. Looks like the message
is incorrectly assumed to be of the new IPMB type, because type is never
set and message is allocated with kmalloc() not kzalloc().

Fixes: 059747c245f0 ("ipmi: Add support for IPMB direct messages")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
Would it be possible to get something like this to Linus ASAP?
It's flipping over all my test boxes.
---
 drivers/char/ipmi/ipmi_msghandler.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index deed355422f4..f0b18c25cbb1 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -5031,6 +5031,7 @@ struct ipmi_smi_msg *ipmi_alloc_smi_msg(void)
 	if (rv) {
 		rv->done = free_smi_msg;
 		rv->user_data = NULL;
+		rv->type = IPMI_SMI_MSG_TYPE_NORMAL;
 		atomic_inc(&smi_msg_inuse_count);
 	}
 	return rv;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ipmi: fix oob access due to uninit smi_msg type
  2021-11-24 21:03 [PATCH] ipmi: fix oob access due to uninit smi_msg type Jakub Kicinski
@ 2021-11-25 14:21 ` Corey Minyard
  2021-11-25 15:05   ` Jakub Kicinski
  0 siblings, 1 reply; 4+ messages in thread
From: Corey Minyard @ 2021-11-25 14:21 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: andrew.manley, openipmi-developer, linux-kernel, kernel-team

On Wed, Nov 24, 2021 at 01:03:23PM -0800, Jakub Kicinski wrote:
> We're hitting OOB accesses in handle_ipmb_direct_rcv_rsp() (memcpy of
> size -1) after user space generates a message. Looks like the message
> is incorrectly assumed to be of the new IPMB type, because type is never
> set and message is allocated with kmalloc() not kzalloc().
> 
> Fixes: 059747c245f0 ("ipmi: Add support for IPMB direct messages")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

This is correct, and in my queue.  Thanks for the fix.

-corey

> ---
> Would it be possible to get something like this to Linus ASAP?
> It's flipping over all my test boxes.
> ---
>  drivers/char/ipmi/ipmi_msghandler.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
> index deed355422f4..f0b18c25cbb1 100644
> --- a/drivers/char/ipmi/ipmi_msghandler.c
> +++ b/drivers/char/ipmi/ipmi_msghandler.c
> @@ -5031,6 +5031,7 @@ struct ipmi_smi_msg *ipmi_alloc_smi_msg(void)
>  	if (rv) {
>  		rv->done = free_smi_msg;
>  		rv->user_data = NULL;
> +		rv->type = IPMI_SMI_MSG_TYPE_NORMAL;
>  		atomic_inc(&smi_msg_inuse_count);
>  	}
>  	return rv;
> -- 
> 2.31.1
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ipmi: fix oob access due to uninit smi_msg type
  2021-11-25 14:21 ` Corey Minyard
@ 2021-11-25 15:05   ` Jakub Kicinski
  2021-11-26  3:28     ` Corey Minyard
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2021-11-25 15:05 UTC (permalink / raw)
  To: Corey Minyard; +Cc: andrew.manley, openipmi-developer, linux-kernel

On Thu, 25 Nov 2021 08:21:40 -0600 Corey Minyard wrote:
> On Wed, Nov 24, 2021 at 01:03:23PM -0800, Jakub Kicinski wrote:
> > We're hitting OOB accesses in handle_ipmb_direct_rcv_rsp() (memcpy of
> > size -1) after user space generates a message. Looks like the message
> > is incorrectly assumed to be of the new IPMB type, because type is never
> > set and message is allocated with kmalloc() not kzalloc().
> > 
> > Fixes: 059747c245f0 ("ipmi: Add support for IPMB direct messages")
> > Signed-off-by: Jakub Kicinski <kuba@kernel.org>  
> 
> This is correct, and in my queue.  Thanks for the fix.

Where is your queue, BTW? I see not T entry in MAINTAINERS and nothing
of note in the github tree from which you send PRs.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ipmi: fix oob access due to uninit smi_msg type
  2021-11-25 15:05   ` Jakub Kicinski
@ 2021-11-26  3:28     ` Corey Minyard
  0 siblings, 0 replies; 4+ messages in thread
From: Corey Minyard @ 2021-11-26  3:28 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: andrew.manley, openipmi-developer, linux-kernel

On Thu, Nov 25, 2021 at 07:05:43AM -0800, Jakub Kicinski wrote:
> On Thu, 25 Nov 2021 08:21:40 -0600 Corey Minyard wrote:
> > On Wed, Nov 24, 2021 at 01:03:23PM -0800, Jakub Kicinski wrote:
> > > We're hitting OOB accesses in handle_ipmb_direct_rcv_rsp() (memcpy of
> > > size -1) after user space generates a message. Looks like the message
> > > is incorrectly assumed to be of the new IPMB type, because type is never
> > > set and message is allocated with kmalloc() not kzalloc().
> > > 
> > > Fixes: 059747c245f0 ("ipmi: Add support for IPMB direct messages")
> > > Signed-off-by: Jakub Kicinski <kuba@kernel.org>  
> > 
> > This is correct, and in my queue.  Thanks for the fix.
> 
> Where is your queue, BTW? I see not T entry in MAINTAINERS and nothing
> of note in the github tree from which you send PRs.

It's at github.com:cminyard/linux-ipmi.git for-next

I hadn't pushed it up yet, I wanted to do some testing.  I just pushed
it.

-corey


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-26  4:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-24 21:03 [PATCH] ipmi: fix oob access due to uninit smi_msg type Jakub Kicinski
2021-11-25 14:21 ` Corey Minyard
2021-11-25 15:05   ` Jakub Kicinski
2021-11-26  3:28     ` Corey Minyard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).