From: Corey Minyard <cminyard@mvista.com>
To: Asmaa Mnebhi <Asmaa@mellanox.com>
Cc: Colin King <colin.king@canonical.com>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Vadim Pasternak <vadimp@mellanox.com>,
"openipmi-developer@lists.sourceforge.net"
<openipmi-developer@lists.sourceforge.net>,
"kernel-janitors@vger.kernel.org"
<kernel-janitors@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH][next] drivers: ipmi: fix off-by-one bounds check that leads to a out-of-bounds write
Date: Mon, 20 Jan 2020 11:01:32 -0600 [thread overview]
Message-ID: <20200120170132.GT2886@minyard.net> (raw)
In-Reply-To: <DB6PR0501MB2712BEBCF959566EAB063769DA340@DB6PR0501MB2712.eurprd05.prod.outlook.com>
On Tue, Jan 14, 2020 at 03:50:22PM +0000, Asmaa Mnebhi wrote:
> Reviewed-by: Asmaa Mnebhi <asmaa@mellanox.com>
Thanks, I've picked this up in my next tree.
-corey
>
> -----Original Message-----
> From: Colin King <colin.king@canonical.com>
> Sent: Tuesday, January 14, 2020 9:41 AM
> To: Corey Minyard <cminyard@mvista.com>; Arnd Bergmann <arnd@arndb.de>; Greg Kroah-Hartman <gregkh@linuxfoundation.org>; Vadim Pasternak <vadimp@mellanox.com>; Asmaa Mnebhi <Asmaa@mellanox.com>; openipmi-developer@lists.sourceforge.net
> Cc: kernel-janitors@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [PATCH][next] drivers: ipmi: fix off-by-one bounds check that leads to a out-of-bounds write
>
> From: Colin Ian King <colin.king@canonical.com>
>
> The end of buffer check is off-by-one since the check is against an index that is pre-incremented before a store to buf[]. Fix this adjusting the bounds check appropriately.
>
> Addresses-Coverity: ("Out-of-bounds write")
> Fixes: 51bd6f291583 ("Add support for IPMB driver")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/char/ipmi/ipmb_dev_int.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/char/ipmi/ipmb_dev_int.c b/drivers/char/ipmi/ipmb_dev_int.c
> index 9fdae83e59e0..382b28f1cf2f 100644
> --- a/drivers/char/ipmi/ipmb_dev_int.c
> +++ b/drivers/char/ipmi/ipmb_dev_int.c
> @@ -279,7 +279,7 @@ static int ipmb_slave_cb(struct i2c_client *client,
> break;
>
> case I2C_SLAVE_WRITE_RECEIVED:
> - if (ipmb_dev->msg_idx >= sizeof(struct ipmb_msg))
> + if (ipmb_dev->msg_idx >= sizeof(struct ipmb_msg) - 1)
> break;
>
> buf[++ipmb_dev->msg_idx] = *val;
> --
> 2.24.0
>
prev parent reply other threads:[~2020-01-20 17:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-14 14:40 [PATCH][next] drivers: ipmi: fix off-by-one bounds check that leads to a out-of-bounds write Colin King
2020-01-14 15:50 ` Asmaa Mnebhi
2020-01-20 17:01 ` 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=20200120170132.GT2886@minyard.net \
--to=cminyard@mvista.com \
--cc=Asmaa@mellanox.com \
--cc=arnd@arndb.de \
--cc=colin.king@canonical.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=openipmi-developer@lists.sourceforge.net \
--cc=vadimp@mellanox.com \
/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;
as well as URLs for NNTP newsgroup(s).