public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@idosch.org>
To: "dongchenchen (A)" <dongchenchen2@huawei.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
	davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
	horms@kernel.org, jiri@resnulli.us, oscmaes92@gmail.com,
	linux@treblig.org, pedro.netdev@dondevamos.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	yuehaibing@huawei.com, zhangchangzhong@huawei.com
Subject: Re: [PATCH net] net: vlan: fix VLAN 0 refcount imbalance of toggling filtering during runtime
Date: Mon, 30 Jun 2025 11:14:06 +0300	[thread overview]
Message-ID: <aGJHTh7aB26PGRFN@shredder> (raw)
In-Reply-To: <6ad61ca2-606b-4f1a-a811-47e5cfd48c38@huawei.com>

On Mon, Jun 30, 2025 at 09:25:42AM +0800, dongchenchen (A) wrote:
> 
> > On Thu, Jun 26, 2025 at 11:41:45AM +0800, dongchenchen (A) wrote:
> > As I understand it, there are two issues:
> > 
> > 1. VID 0 is deleted when it shouldn't. This leads to the crashes you
> > shared.
> > 
> > 2. VID 0 is not deleted when it should. This leads to memory leaks like
> > [1] with a reproducer such as [2].
> > 
> > AFAICT, your proposed patch solves the second issue, but only partially
> > addresses the first issue. The automatic addition of VID 0 is assumed to
> > be successful, but it can fail due to hardware issues or memory
> > allocation failures. I realize it is not common, but it can happen. If
> > you annotate __vlan_vid_add() [3] and inject failures [4], you will see
> > that the crashes still happen with your patch.
> 
> Hi, Ido
> Thanks for your review!
> 
> > WDYT about something like [5]? Basically, noting in the VLAN info
> 
> This fix [5] can completely solve the problem. I will send it together with
> selftest patch.

Thanks. Please add tests for both cases (memory leak and crash).

> 
> > whether VID 0 was automatically added upon NETDEV_UP and based on that
> > decide whether it should be deleted upon NETDEV_DOWN, regardless of
> > "rx-vlan-filter".
> 
> one small additional question: vlan0 will not exist if netdev set rx-vlan-filter after NETDEV_UP.
> Will this cause a difference in the processing logic for 8021q packets?

AFAICT the proposed patch does not change this behavior. Users can bring
the netdev down and then up if they want the kernel to add VID 0. My
understanding is that "rx-vlan-filter on" without VID 0 will cause
prio-tagged packets to be dropped by the underlying device.

      reply	other threads:[~2025-06-30  8:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-23 11:30 [PATCH net] net: vlan: fix VLAN 0 refcount imbalance of toggling filtering during runtime Dong Chenchen
2025-06-25  0:42 ` Jakub Kicinski
2025-06-26  3:41   ` dongchenchen (A)
2025-06-27 14:41     ` Ido Schimmel
2025-06-30  1:25       ` dongchenchen (A)
2025-06-30  8:14         ` Ido Schimmel [this message]

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=aGJHTh7aB26PGRFN@shredder \
    --to=idosch@idosch.org \
    --cc=davem@davemloft.net \
    --cc=dongchenchen2@huawei.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@treblig.org \
    --cc=netdev@vger.kernel.org \
    --cc=oscmaes92@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=pedro.netdev@dondevamos.com \
    --cc=yuehaibing@huawei.com \
    --cc=zhangchangzhong@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