From: Simon Horman <simon.horman@corigine.com>
To: Foster Snowhill <forst@pen.gy>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Georgi Valkov <gvalkov@gmail.com>,
linux-usb@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH net-next v2 1/2] usbnet: ipheth: fix risk of NULL pointer deallocation
Date: Fri, 26 May 2023 09:52:42 +0200 [thread overview]
Message-ID: <ZHBlShZDu3C8VOl3@corigine.com> (raw)
In-Reply-To: <20230525194255.4516-1-forst@pen.gy>
On Thu, May 25, 2023 at 09:42:54PM +0200, Foster Snowhill wrote:
> From: Georgi Valkov <gvalkov@gmail.com>
>
> The cleanup precedure in ipheth_probe will attempt to free a
> NULL pointer in dev->ctrl_buf if the memory allocation for
> this buffer is not successful. Rearrange the goto labels to
> avoid this risk.
Hi Georgi and Foster,
kfree will ignore a NULL argument, so I think the existing code is safe.
But given the name of the label I do agree there is scope for a cleanup
here.
Could you consider rewording the patch description accordingly?
> Signed-off-by: Georgi Valkov <gvalkov@gmail.com>
If Georgi is the author of the patch, which seems to be the case,
then the above is correct. But as the patch is being posted by Foster
I think it should be followed by a Signed-off-by line for Foster.
Link: https://www.kernel.org/doc/html/latest/process/submitting-patches.html?highlight=signed+off#developer-s-certificate-of-origin-1-1
> ---
> drivers/net/usb/ipheth.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
> index 6a769df0b..8875a3d0e 100644
> --- a/drivers/net/usb/ipheth.c
> +++ b/drivers/net/usb/ipheth.c
> @@ -510,8 +510,8 @@ static int ipheth_probe(struct usb_interface *intf,
> ipheth_free_urbs(dev);
> err_alloc_urbs:
> err_get_macaddr:
> -err_alloc_ctrl_buf:
> kfree(dev->ctrl_buf);
> +err_alloc_ctrl_buf:
> err_endpoints:
> free_netdev(netdev);
> return retval;
--
pw-bot: cr
next prev parent reply other threads:[~2023-05-26 7:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-25 19:42 [PATCH net-next v2 1/2] usbnet: ipheth: fix risk of NULL pointer deallocation Foster Snowhill
2023-05-25 19:42 ` [PATCH net-next v2 2/2] usbnet: ipheth: add CDC NCM support Foster Snowhill
2023-05-26 7:52 ` Simon Horman [this message]
2023-05-26 8:33 ` [PATCH net-next v2 1/2] usbnet: ipheth: fix risk of NULL pointer deallocation George Valkov
2023-05-26 8:41 ` Simon Horman
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=ZHBlShZDu3C8VOl3@corigine.com \
--to=simon.horman@corigine.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=forst@pen.gy \
--cc=gvalkov@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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).