[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210519132304.GD32682@kadam>
Date: Wed, 19 May 2021 16:23:04 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Johan Hovold <johan@...nel.org>
Cc: "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, linux-usb@...r.kernel.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net] net: hso: bail out on interrupt URB allocation
failure
On Wed, May 19, 2021 at 02:47:17PM +0200, Johan Hovold wrote:
> Commit 31db0dbd7244 ("net: hso: check for allocation failure in
> hso_create_bulk_serial_device()") recently started returning an error
> when the driver fails to allocate resources for the interrupt endpoint
> and tiocmget functionality.
>
> For consistency let's bail out from probe also if the URB allocation
> fails.
>
> Signed-off-by: Johan Hovold <johan@...nel.org>
> ---
> drivers/net/usb/hso.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
> index 260f850d69eb..b48b2a25210c 100644
> --- a/drivers/net/usb/hso.c
> +++ b/drivers/net/usb/hso.c
> @@ -2635,14 +2635,14 @@ static struct hso_device *hso_create_bulk_serial_device(
> }
>
> tiocmget->urb = usb_alloc_urb(0, GFP_KERNEL);
> - if (tiocmget->urb) {
> - mutex_init(&tiocmget->mutex);
> - init_waitqueue_head(&tiocmget->waitq);
> - } else
> - hso_free_tiomget(serial);
Thanks! The original code works, but it's so suspicious looking because
you would think hso_free_tiomget() lead to a use after free later.
Reviewed-by: Dan Carpenter <dan.carpenter@...cle.com>
regards,
dan carpenter
Powered by blists - more mailing lists