[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANEJEGt=JZzPCnqGiKLZhXkm9or8yZTT7KXgEsSbWa22aAmrFQ@mail.gmail.com>
Date: Thu, 17 Feb 2022 12:03:10 -0800
From: Grant Grundler <grundler@...omium.org>
To: Oliver Neukum <oneukum@...e.com>
Cc: David Miller <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Grant Grundler <grundler@...omium.org>,
Andrew Lunn <andrew@...n.ch>, jgg@...pe.ca,
linux-usb@...r.kernel.org, Arnd Bergmann <arnd@...db.de>,
netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH] sr9700: sanity check for packet length
On Thu, Feb 17, 2022 at 5:10 AM Oliver Neukum <oneukum@...e.com> wrote:
>
> A malicious device can leak heap data to user space
> providing bogus frame lengths. Introduce a sanity check.
>
> Signed-off-by: Oliver Neukum <oneukum@...e.com>
Reviewed-by: Grant Grundler <grundler@...omium.org>
> ---
> drivers/net/usb/sr9700.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/usb/sr9700.c b/drivers/net/usb/sr9700.c
> index b658510cc9a4..5a53e63d33a6 100644
> --- a/drivers/net/usb/sr9700.c
> +++ b/drivers/net/usb/sr9700.c
> @@ -413,7 +413,7 @@ static int sr9700_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
> /* ignore the CRC length */
> len = (skb->data[1] | (skb->data[2] << 8)) - 4;
>
> - if (len > ETH_FRAME_LEN)
> + if (len > ETH_FRAME_LEN || len > skb->len)
good catch.
> return 0;
>
> /* the last packet of current skb */
> --
> 2.34.1
>
Powered by blists - more mailing lists