public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Corey Minyard <minyard@acm.org>
To: Colin King <colin.king@canonical.com>
Cc: openipmi-developer@lists.sourceforge.net,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [Openipmi-developer] [PATCH][next] ipmi: ipmb: Fix off-by-one size check on rcvlen
Date: Tue, 5 Oct 2021 10:40:31 -0500	[thread overview]
Message-ID: <20211005154031.GD5381@minyard.net> (raw)
In-Reply-To: <20211005151611.305383-1-colin.king@canonical.com>

On Tue, Oct 05, 2021 at 04:16:11PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> There is an off-by-one bounds check on the rcvlen causing a potential
> out of bounds write on iidev->rcvmsg. Fix this by using the >= operator
> on the bounds check rather than the > operator.

Got it, thanks.

-corey

> 
> Addresses-Coverity: ("Out-of-bounds write")
> Fixes: 0ba0c3c5d1c1 ("ipmi:ipmb: Add initial support for IPMI over IPMB")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/char/ipmi/ipmi_ipmb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/char/ipmi/ipmi_ipmb.c b/drivers/char/ipmi/ipmi_ipmb.c
> index b10a1fd9c563..77ebec4ed28e 100644
> --- a/drivers/char/ipmi/ipmi_ipmb.c
> +++ b/drivers/char/ipmi/ipmi_ipmb.c
> @@ -192,7 +192,7 @@ static int ipmi_ipmb_slave_cb(struct i2c_client *client,
>  		break;
>  
>  	case I2C_SLAVE_WRITE_RECEIVED:
> -		if (iidev->rcvlen > sizeof(iidev->rcvmsg))
> +		if (iidev->rcvlen >= sizeof(iidev->rcvmsg))
>  			iidev->overrun = true;
>  		else
>  			iidev->rcvmsg[iidev->rcvlen++] = *val;
> -- 
> 2.32.0
> 
> 
> 
> _______________________________________________
> Openipmi-developer mailing list
> Openipmi-developer@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openipmi-developer

      reply	other threads:[~2021-10-05 15:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-05 15:16 [PATCH][next] ipmi: ipmb: Fix off-by-one size check on rcvlen Colin King
2021-10-05 15:40 ` Corey Minyard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211005154031.GD5381@minyard.net \
    --to=minyard@acm.org \
    --cc=colin.king@canonical.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openipmi-developer@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox