From: "Bjørn Mork" <bjorn@mork.no>
To: Madalin-Cristian Bucur <madalin.bucur@freescale.com>
Cc: Li RongQing <roy.qing.li@gmail.com>,
Eric Dumazet <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>,
"netdev\@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: segfault after VLAN change
Date: Wed, 02 Jul 2014 09:11:09 +0200 [thread overview]
Message-ID: <87simk1bhu.fsf@nemi.mork.no> (raw)
In-Reply-To: <42408b4f154d434d9838b83ae2dc15db@BL2PR03MB545.namprd03.prod.outlook.com> (Madalin-Cristian Bucur's message of "Tue, 1 Jul 2014 16:55:13 +0000")
Madalin-Cristian Bucur <madalin.bucur@freescale.com> writes:
> Hello,
>
> I've discovered that the commit:
>
> commit 5a4ae5f6e7d4b2b5a9b8981d513345053e40b6ac
> Author: Li RongQing <roy.qing.li@gmail.com>
> Date: Mon Apr 21 19:49:08 2014 +0800
>
> vlan: unnecessary to check if vlan_pcpu_stats is NULL
>
> if allocating memory for vlan_pcpu_stats failed, the device can not be operated
>
> Signed-off-by:
> Cc: Eric Dumazet <edumazet@google.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
>
> is causing a segfault when removing vlan on a e1000 device (reproduces with other devices as well).
> Re-adding the check or reverting the patch removes the issue (log below).
Yes, that commit should be reverted.
The commit message makes it clear that only allocation failures were
considered, while a simple grep reveals that there at least one site
where that field is explicitly NULLed:
bjorn@nemi:/usr/local/src/git/linux$ git grep vlan_pcpu_stats net/8021q/
net/8021q/vlan_core.c: struct vlan_pcpu_stats *rx_stats;
net/8021q/vlan_core.c: rx_stats = this_cpu_ptr(vlan_dev_priv(vlan_dev)->vlan_pcpu_stats);
net/8021q/vlan_dev.c: struct vlan_pcpu_stats *stats;
net/8021q/vlan_dev.c: stats = this_cpu_ptr(vlan->vlan_pcpu_stats);
net/8021q/vlan_dev.c: this_cpu_inc(vlan->vlan_pcpu_stats->tx_dropped);
net/8021q/vlan_dev.c: vlan_dev_priv(dev)->vlan_pcpu_stats = netdev_alloc_pcpu_stats(struct vlan_pcpu_stats);
net/8021q/vlan_dev.c: if (!vlan_dev_priv(dev)->vlan_pcpu_stats)
net/8021q/vlan_dev.c: free_percpu(vlan->vlan_pcpu_stats);
net/8021q/vlan_dev.c: vlan->vlan_pcpu_stats = NULL;
net/8021q/vlan_dev.c: struct vlan_pcpu_stats *p;
net/8021q/vlan_dev.c: p = per_cpu_ptr(vlan_dev_priv(dev)->vlan_pcpu_stats, i);
Without looking further it seems likely that this is done during
teardown, making the original NULL check necessary.
Bjørn
next prev parent reply other threads:[~2014-07-02 7:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-01 16:55 segfault after VLAN change Madalin-Cristian Bucur
2014-07-02 7:11 ` Bjørn Mork [this message]
2014-07-02 8:23 ` Eric Dumazet
2014-07-02 8:33 ` Eric Dumazet
2014-07-02 8:55 ` Madalin-Cristian Bucur
2014-07-02 10:22 ` Bjørn Mork
2014-07-02 9:25 ` [PATCH net] vlan: free percpu stats in device destructor Eric Dumazet
2014-07-03 0:02 ` David Miller
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=87simk1bhu.fsf@nemi.mork.no \
--to=bjorn@mork.no \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=madalin.bucur@freescale.com \
--cc=netdev@vger.kernel.org \
--cc=roy.qing.li@gmail.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).