From: Dan Carpenter <dan.carpenter@oracle.com>
To: Johan Hovold <johan@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
linux-usb@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: hso: bail out on interrupt URB allocation failure
Date: Wed, 19 May 2021 16:23:04 +0300 [thread overview]
Message-ID: <20210519132304.GD32682@kadam> (raw)
In-Reply-To: <20210519124717.31144-1-johan@kernel.org>
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@kernel.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@oracle.com>
regards,
dan carpenter
next prev parent reply other threads:[~2021-05-19 13:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-19 12:47 [PATCH net] net: hso: bail out on interrupt URB allocation failure Johan Hovold
2021-05-19 13:23 ` Dan Carpenter [this message]
2021-05-19 20:20 ` patchwork-bot+netdevbpf
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=20210519132304.GD32682@kadam \
--to=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=johan@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.