From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Grigory Bazilevich <bazilevich@sicamp.ru>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Xin Ji <xji@analogixsemi.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
lvc-project@linuxtesting.org
Subject: Re: [PATCH] usb: typec: anx7411: Fix possible buffer overflow in anx7411_send_msg()
Date: Fri, 22 Mar 2024 11:46:57 +0200 [thread overview]
Message-ID: <Zf1TkQVipUYhstRZ@kuha.fi.intel.com> (raw)
In-Reply-To: <20240316203354.81591-1-bazilevich@sicamp.ru>
On Sat, Mar 16, 2024 at 11:33:53PM +0300, Grigory Bazilevich wrote:
> Passing a size argument greater than or equal to MAX_BUF_LEN causes
> a buffer overflow when the checksum is written.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
> Signed-off-by: Grigory Bazilevich <bazilevich@sicamp.ru>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/anx7411.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c
> index b12a07edc71b..70ba56dfb22b 100644
> --- a/drivers/usb/typec/anx7411.c
> +++ b/drivers/usb/typec/anx7411.c
> @@ -733,7 +733,7 @@ static int anx7411_send_msg(struct anx7411_data *ctx, u8 type, u8 *buf, u8 size)
> u8 crc;
> int ret;
>
> - size = min_t(u8, size, (u8)MAX_BUF_LEN);
> + size = min_t(u8, size, (u8)(MAX_BUF_LEN - 1));
> memcpy(msg->buf, buf, size);
> msg->msg_type = type;
> /* msg len equals buffer length + msg_type */
> --
> 2.39.2
--
heikki
prev parent reply other threads:[~2024-03-22 9:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-16 20:33 Grigory Bazilevich
2024-03-17 7:52 ` Christophe JAILLET
2024-03-19 6:57 ` Xin Ji
2024-03-22 9:46 ` Heikki Krogerus [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=Zf1TkQVipUYhstRZ@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=bazilevich@sicamp.ru \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=xji@analogixsemi.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
all inboxes | Powered by JetHome®