mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.com>
To: "Ren Mingshuai" <renmingshuai@huawei.com>,
	kuba@kernel.org, "Bjørn Mork" <bjorn@mork.no>
Cc: caowangbao@huawei.com, davem@davemloft.net,
	khlebnikov@openvz.org, liaichun@huawei.com,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	oneukum@suse.com, yanan@huawei.com
Subject: Re: [PATCH] net: usbnet: Fix potential NULL pointer dereference
Date: Mon, 6 Nov 2023 11:18:39 +0100	[thread overview]
Message-ID: <80af8b7a-c543-4386-bb0c-a356189581a0@suse.com> (raw)
In-Reply-To: <20231102090630.938759-1-renmingshuai@huawei.com>



On 02.11.23 10:06, Ren Mingshuai wrote:
>>>> 23ba07991dad said SKB can be NULL without describing the triggering
>>>> scenario. Always Check it before dereference to void potential NULL
>>>> pointer dereference.
>>> I've tried to find out the scenarios where SKB is NULL, but failed.
>>> It seems impossible for SKB to be NULL. If SKB can be NULL, please
>>> tell me the reason and I'd be very grateful.
>>
>> What do you mean? Grepping the function name shows call sites with NULL getting passed as skb.
> 
> Yes And I just learned that during the cdc_ncm_driver.probe, it is possible to pass a NULL SKB to usbnet_start_xmit().

Hi,

yes it looks like NCM does funky things, but what does that mean?

ndp_to_end_store()

         /* flush pending data before changing flag */
         netif_tx_lock_bh(dev->net);
         usbnet_start_xmit(NULL, dev->net);
         spin_lock_bh(&ctx->mtx);
         if (enable)

expects some odd semantics from it. The proposed patch simply
increases the drop counter, which is by itself questionable, as
we drop nothing.

But it definitely does no IO, so we flush nothing.
That is, we clearly have bug(s) but the patch only papers over
them.
And frankly, the basic question needs to be answered:
Are you allowed to call ndo_start_xmit() with a NULL skb?

My understanding until now was that you must not.

	Regards
		Oliver



  reply	other threads:[~2023-11-06 10:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-01 12:35 Ren Mingshuai
2023-11-01 12:55 ` Ren Mingshuai
2023-11-02  4:38   ` Jakub Kicinski
2023-11-02  9:06     ` Ren Mingshuai
2023-11-06 10:18       ` Oliver Neukum [this message]
2023-11-06 10:55         ` Bjørn Mork
2023-11-06 12:53           ` Oliver Neukum
2023-11-06 12:59       ` Oliver Neukum

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=80af8b7a-c543-4386-bb0c-a356189581a0@suse.com \
    --to=oneukum@suse.com \
    --cc=bjorn@mork.no \
    --cc=caowangbao@huawei.com \
    --cc=davem@davemloft.net \
    --cc=khlebnikov@openvz.org \
    --cc=kuba@kernel.org \
    --cc=liaichun@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=renmingshuai@huawei.com \
    --cc=yanan@huawei.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®