* Re: [PATCH] brcm80211: brcmfmac: Ensure that incoming skb's are writable
From: James Hughes @ 2017-04-24 8:45 UTC (permalink / raw)
To: Arend Van Spriel
Cc: netdev, Franky Lin, Hante Meuleman, Kalle Valo, linux-wireless
In-Reply-To: <e2e5d950-d186-1a27-4b30-4ae2e9838103@broadcom.com>
On 23 April 2017 at 20:34, Arend Van Spriel
<arend.vanspriel@broadcom.com> wrote:
> On 21-4-2017 11:22, James Hughes wrote:
>> On 20 April 2017 at 20:48, Arend van Spriel
>> <arend.vanspriel@broadcom.com> wrote:
>>> + linux-wireless
>>>
>>> On 4/20/2017 1:16 PM, James Hughes wrote:
>>>>
>>>> The driver was adding header information to incoming skb
>>>> without ensuring the head was uncloned and hence writable.
>>>>
>>>> skb_cow_head has been used to ensure they are writable, however,
>>>> this required some changes to error handling to ensure that
>>>> if skb_cow_head failed it was not ignored.
>>>>
>>>> This really needs to be reviewed by someone who is more familiar
>>>> with this code base to ensure any deallocation of skb's is
>>>> still correct.
>>>>
>>>> Signed-off-by: James Hughes <james.hughes@raspberrypi.org>
>>>> ---
>>>> .../wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 15 ++++++++--
>>>> .../wireless/broadcom/brcm80211/brcmfmac/core.c | 23 +++++-----------
>>>> .../broadcom/brcm80211/brcmfmac/fwsignal.c | 32
>>>> +++++++++++++++++-----
>>>> .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 7 ++++-
>>>> 4 files changed, 51 insertions(+), 26 deletions(-)
>>>>
>>>
>>> [...]
>>>
>>>> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
>>>> b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
>>>> index 5eaac13..08272e8 100644
>>>> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
>>>> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
>>>> @@ -198,7 +198,7 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct
>>>> sk_buff *skb,
>>>> int ret;
>>>> struct brcmf_if *ifp = netdev_priv(ndev);
>>>> struct brcmf_pub *drvr = ifp->drvr;
>>>> - struct ethhdr *eh = (struct ethhdr *)(skb->data);
>>>> + struct ethhdr *eh;
>>>> brcmf_dbg(DATA, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
>>>> @@ -212,23 +212,14 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct
>>>> sk_buff *skb,
>>>> }
>>>> /* Make sure there's enough room for any header */
>>>> - if (skb_headroom(skb) < drvr->hdrlen) {
>>>> - struct sk_buff *skb2;
>>>> -
>>>> - brcmf_dbg(INFO, "%s: insufficient headroom\n",
>>>> - brcmf_ifname(ifp));
>>>> - drvr->bus_if->tx_realloc++;
>>>> - skb2 = skb_realloc_headroom(skb, drvr->hdrlen);
>>>> - dev_kfree_skb(skb);
>>>> - skb = skb2;
>>>> - if (skb == NULL) {
>>>> - brcmf_err("%s: skb_realloc_headroom failed\n",
>>>> - brcmf_ifname(ifp));
>>>> - ret = -ENOMEM;
>>>> - goto done;
>>>> - }
>>>
>>>
>>> What you are throwing away here is code that assures there is sufficient
>>> headroom for protocol and bus layer in the tx path, because that is
>>> determined by drvr->hdrlen. This is where the skb is handed to the driver so
>>> if you could leave the functionality above *and* assure it is writeable that
>>> would be the best solution as there is no need for all the other changes
>>> down the tx path.
>>
>> The skb_cow_head function takes the required headroom as a parameter
>> and will ensure that there is enough space, so I don't think this code
>> segment is
>> required or have I misunderstood what you mean here?
>
> I looked more into what skb_cow_head() and skb_realloc_headroom()
> actually do and it seems you are right.
>
>> Is it safe to rely on the _cow_ being done here and not further down
>> in the stack?
>> Or at least checked further down in the stack. Previous comments from
>> another patch
>> requested that the _cow_ be done close to the actual addition of the
>> header. I presume
>> it is unlikely/impossible that the functions that add header
>> information down the stack
>> will be called without the above being done first?
>
> It is safe. During probe sequence each layer in the driver stack
> increments drvr->hdrlen with headroom it needs. So drvr->hdrlen will
> indicate the total headroom needed when .start_xmit() is called. And
> yes, the .start_xmit() is the single point of entry in the transmit
> path. So the other locations where skb_push() is done are safe.
>
OK, I will redo the patch (making it v3 + changelogs), taking this in
to account.
>>>
>>>> + ret = skb_cow_head(skb, drvr->hdrlen);
>>>> + if (ret) {
>>>
>>>
>>> So move the realloc code above here instead of simply freeing the skb.
>>>
>>>> + dev_kfree_skb_any(skb);
>>>> + goto done;
>>>> }
>>>> + eh = (struct ethhdr *)(skb->data);
>>>
>>>
>>> Now this is actually a separate fix so I would like a separate patch for it.
>>>
>>
>> No problem, but see final paragraph below.
>
> Let me see...
I'll split this fix out, but should I issue it in the same patch set
or as a separate patch?
And for a different patch, should I base it on the _cow_ version patch
or the original version?
>
>>> I have a RPi3 sitting on my desk so how can I replicate the issue. It was
>>> something about broadcast/multicast traffic when using AP mode and a bridge,
>>> right?
>>>
>>> Regards,
>>> Arend
>>
>> See this issue for details on replication.
>> https://github.com/raspberrypi/firmware/issues/673
>>
>> The bridge I use is setup using a similar procedure to that described
>> here. https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md
>>
>> I'm happy to pass over this work to you guys if you think it is
>> appropriate, you are the
>> experts on the codebase.
>
> Sure. However, I must say you did an excellent job digging into the
> issue and root causing it. We always were under the impression that we
> could treat the skb as our own when handed to us in .start_xmit() callback.
>
> Regards,
> Arend
Thanks! I suspect that a few drivers are making the same mistake, Eric
found 6 over and above the smsc95xx and this one that I originally
found.
Regards
James
^ permalink raw reply
* Re: [PATCH v2 2/2] iproute2: add support for invisible qdisc dumping
From: Jiri Pirko @ 2017-04-24 8:43 UTC (permalink / raw)
To: Jiri Kosina
Cc: David S. Miller, Stephen Hemminger, Eric Dumazet,
Jamal Hadi Salim, Phil Sutter, Cong Wang, Daniel Borkmann, netdev,
linux-kernel
In-Reply-To: <alpine.LSU.2.20.1703081303490.31814@cbobk.fhfr.pm>
Wed, Mar 08, 2017 at 01:04:42PM CET, jikos@kernel.org wrote:
>From: Jiri Kosina <jkosina@suse.cz>
>
>Support the new TCA_DUMP_INVISIBLE netlink attribute that allows asking
>kernel to perform 'full qdisc dump', as for historical reasons some of the
>default qdiscs are being hidden by the kernel.
>
>The command syntax is being extended by voluntary 'invisible' argument to
>'tc qdisc show'.
>
>Signed-off-by: Jiri Kosina <jkosina@suse.cz>
>---
[...]
>@@ -325,7 +328,25 @@ static int tc_qdisc_list(int argc, char **argv)
> filter_ifindex = t.tcm_ifindex;
> }
>
>- if (rtnl_dump_request(&rth, RTM_GETQDISC, &t, sizeof(t)) < 0) {
>+ if (dump_invisible) {
>+ struct {
>+ struct nlmsghdr n;
>+ struct tcmsg t;
>+ char buf[256];
>+ } req = {
>+ .n.nlmsg_type = RTM_GETQDISC,
>+ .n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)),
>+ };
>+
>+ req.t.tcm_family = AF_UNSPEC;
>+
>+ addattr(&req.n, 256, TCA_DUMP_INVISIBLE);
>+ if (rtnl_dump_request_n(&rth, &req.n) < 0) {
Jirko, you ignore the values that were previously set in "t". I think
that you can change this to do rtnl_dump_request_n always and simplify
the code a bit.
>+ perror("Cannot send dump request");
>+ return 1;
>+ }
>+
>+ } else if (rtnl_dump_request(&rth, RTM_GETQDISC, &t, sizeof(t)) < 0) {
> perror("Cannot send dump request");
> return 1;
> }
>--
>Jiri Kosina
>SUSE Labs
>
^ permalink raw reply
* Re: [Intel-wired-lan] [PATCH 1/2] e1000e: Don't return uninitialized stats
From: Paul Menzel @ 2017-04-24 8:23 UTC (permalink / raw)
To: Benjamin Poirier; +Cc: Jeff Kirsher, netdev, intel-wired-lan, Stefan Priebe
In-Reply-To: <20170421212012.25950-1-bpoirier@suse.com>
Dear Benjamin,
Thank you for your fix.
On 04/21/17 23:20, Benjamin Poirier wrote:
> Some statistics passed to ethtool are garbage because e1000e_get_stats64()
> doesn't write them, for example: tx_heartbeat_errors. This leaks kernel
> memory to userspace and confuses users.
Could you please give specific examples to reproduce the issue? That way
your fix can also be tested.
[…]
Kind regards,
Paul
^ permalink raw reply
* Re: [PATCH net-next] net: dsa: LAN9303: add i2c dependency
From: Juergen Borleis @ 2017-04-24 8:22 UTC (permalink / raw)
To: Tobias Regnery; +Cc: andrew, vivien.didelot, f.fainelli, netdev, linux-kernel
In-Reply-To: <20170424080737.24897-1-tobias.regnery@gmail.com>
Hi Tobias,
On Monday 24 April 2017 10:07:37 Tobias Regnery wrote:
> The Kconfig symbol for the I2C mode of the LAN9303 driver selects
> REGMAP_I2C. This symbol depends on I2C but the driver doesen't has a
> dependency on I2C.
>
> With CONFIG_I2C=n kconfig fails to select REGMAP_I2C and we get the
> following warning:
>
> warning: (NET_DSA_SMSC_LAN9303_I2C) selects REGMAP_I2C which has unmet
> direct dependencies (I2C)
>
> This results in a build failure because the regmap-i2c functions aren't
> available:
>
> drivers/base/regmap/regmap-i2c.c: In function 'regmap_smbus_byte_reg_read':
> drivers/base/regmap/regmap-i2c.c:29:8: error: implicit declaration of function 'i2c_smbus_read_byte_data' [-Werror=implicit-function-declaration]
>
> drivers/base/regmap/regmap-i2c.c: In function 'regmap_smbus_byte_reg_write':
> drivers/base/regmap/regmap-i2c.c:47:9: error: implicit declaration of function 'i2c_smbus_write_byte_data' [-Werror=implicit-function-declaration]
> ...
>
> Fix this by adding a kconfig dependency on the I2C subsystem.
>
> Fixes: be4e119f9914 ("net: dsa: LAN9303: add I2C managed mode support")
> Signed-off-by: Tobias Regnery <tobias.regnery@gmail.com>
> ---
> drivers/net/dsa/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/dsa/Kconfig b/drivers/net/dsa/Kconfig
> index 131a5b1cbfc8..862ee22303c2 100644
> --- a/drivers/net/dsa/Kconfig
> +++ b/drivers/net/dsa/Kconfig
> @@ -59,7 +59,7 @@ config NET_DSA_SMSC_LAN9303
>
> config NET_DSA_SMSC_LAN9303_I2C
> tristate "SMSC/Microchip LAN9303 3-ports 10/100 ethernet switch in I2C managed mode"
> - depends on NET_DSA
> + depends on NET_DSA && I2C
> select NET_DSA_SMSC_LAN9303
> select REGMAP_I2C
> ---help---
Thanks, but already found and fixed by Arnd Bergmann.
jb
--
Pengutronix e.K. | Juergen Borleis |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply
* Re: [Intel-wired-lan] [PATCH 1/2] e1000e: Don't return uninitialized stats
From: Neftin, Sasha @ 2017-04-24 8:17 UTC (permalink / raw)
To: netdev@vger.kernel.org; +Cc: intel-wired-lan, Ruinskiy, Dima
In-Reply-To: <630A6B92B7EDEB45A87E20D3D286660171182EED@hasmsx109.ger.corp.intel.com>
On 4/23/2017 15:53, Neftin, Sasha wrote:
> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces@lists.osuosl.org] On Behalf Of Benjamin Poirier
> Sent: Saturday, April 22, 2017 00:20
> To: Kirsher, Jeffrey T <jeffrey.t.kirsher@intel.com>
> Cc: netdev@vger.kernel.org; intel-wired-lan@lists.osuosl.org; Stefan Priebe <s.priebe@profihost.ag>
> Subject: [Intel-wired-lan] [PATCH 1/2] e1000e: Don't return uninitialized stats
>
> Some statistics passed to ethtool are garbage because e1000e_get_stats64() doesn't write them, for example: tx_heartbeat_errors. This leaks kernel memory to userspace and confuses users.
>
> Do like ixgbe and use dev_get_stats() which first zeroes out rtnl_link_stats64.
>
> Reported-by: Stefan Priebe <s.priebe@profihost.ag>
> Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
> ---
> drivers/net/ethernet/intel/e1000e/ethtool.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/e1000e/ethtool.c b/drivers/net/ethernet/intel/e1000e/ethtool.c
> index 7aff68a4a4df..f117b90cdc2f 100644
> --- a/drivers/net/ethernet/intel/e1000e/ethtool.c
> +++ b/drivers/net/ethernet/intel/e1000e/ethtool.c
> @@ -2063,7 +2063,7 @@ static void e1000_get_ethtool_stats(struct net_device *netdev,
>
> pm_runtime_get_sync(netdev->dev.parent);
>
> - e1000e_get_stats64(netdev, &net_stats);
> + dev_get_stats(netdev, &net_stats);
>
> pm_runtime_put_sync(netdev->dev.parent);
>
> --
> 2.12.2
>
> _______________________________________________
> Intel-wired-lan mailing list
> Intel-wired-lan@lists.osuosl.org
> http://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Hello,
We would like to not accept this patch. Suggested generic method
'*dev_get_stats' (net/core/dev.c) calls 'ops->ndo_get_stats64' method
which eventually calls e1000e_get_stats64 (netdev.c) - so there is same
functionality. Also, see that 'e1000e_get_stats64' method in netdev.c
(line 5928) calls 'memset' with 0's before update statistics. Local
sanity check in our lab shows 'tx_heartbeat_errors' counter reported as 0.
Thanks,
Sasha
^ permalink raw reply
* [PATCH net-next] net: dsa: LAN9303: add i2c dependency
From: Tobias Regnery @ 2017-04-24 8:07 UTC (permalink / raw)
To: andrew, vivien.didelot, f.fainelli, netdev, linux-kernel, jbe
Cc: Tobias Regnery
The Kconfig symbol for the I2C mode of the LAN9303 driver selects
REGMAP_I2C. This symbol depends on I2C but the driver doesen't has a
dependency on I2C.
With CONFIG_I2C=n kconfig fails to select REGMAP_I2C and we get the
following warning:
warning: (NET_DSA_SMSC_LAN9303_I2C) selects REGMAP_I2C which has unmet direct dependencies (I2C)
This results in a build failure because the regmap-i2c functions aren't
available:
drivers/base/regmap/regmap-i2c.c: In function 'regmap_smbus_byte_reg_read':
drivers/base/regmap/regmap-i2c.c:29:8: error: implicit declaration of function 'i2c_smbus_read_byte_data' [-Werror=implicit-function-declaration]
drivers/base/regmap/regmap-i2c.c: In function 'regmap_smbus_byte_reg_write':
drivers/base/regmap/regmap-i2c.c:47:9: error: implicit declaration of function 'i2c_smbus_write_byte_data' [-Werror=implicit-function-declaration]
...
Fix this by adding a kconfig dependency on the I2C subsystem.
Fixes: be4e119f9914 ("net: dsa: LAN9303: add I2C managed mode support")
Signed-off-by: Tobias Regnery <tobias.regnery@gmail.com>
---
drivers/net/dsa/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/dsa/Kconfig b/drivers/net/dsa/Kconfig
index 131a5b1cbfc8..862ee22303c2 100644
--- a/drivers/net/dsa/Kconfig
+++ b/drivers/net/dsa/Kconfig
@@ -59,7 +59,7 @@ config NET_DSA_SMSC_LAN9303
config NET_DSA_SMSC_LAN9303_I2C
tristate "SMSC/Microchip LAN9303 3-ports 10/100 ethernet switch in I2C managed mode"
- depends on NET_DSA
+ depends on NET_DSA && I2C
select NET_DSA_SMSC_LAN9303
select REGMAP_I2C
---help---
--
2.11.0
^ permalink raw reply related
* Re: [PATCH net] xfrm: fix stack access out of bounds with CONFIG_XFRM_SUB_POLICY
From: Herbert Xu @ 2017-04-24 7:59 UTC (permalink / raw)
To: Sabrina Dubroca; +Cc: netdev, Steffen Klassert
In-Reply-To: <20170421120531.GA12502@bistromath.localdomain>
On Fri, Apr 21, 2017 at 02:05:31PM +0200, Sabrina Dubroca wrote:
>
> You're right. I had a note about that but it got lost. The bug
> (ignoring what flavor of flowi is passed) is older than that (from the
> introduction of subpolicies, I suspect, but I would have to dig more
> into the history), but this commit removed the last uses of
> origin/partner.
>
> Looking into raw_sendmsg(), this code may have been safe before
> 9d6ec938019c ("ipv4: Use flowi4 in public route lookup interfaces."),
> since full flowi were used.
>
> If we want a fix for kernels that don't have ca116922afa8, we would
> probably need to take the size of the flowi* struct depending on the
> address family passed to xfrm_resolve_and_create_bundle().
>
>
> I'm not sure how to proceed here, any advice?
I think the Fixes header should simply refer to the commit that
introduced the bug. You're instead using it as a hint for how
to backport the patch. That is beyond the scope of the Fixes
header.
So if the bug started with 9d6ec938019c then just use that in
your Fixes header. If you want to help the backporter with more
information then you can put ca116922afa8 in the body of the commit
description.
Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* Re: macvlan: Fix device ref leak when purging bc_queue
From: Herbert Xu @ 2017-04-24 7:56 UTC (permalink / raw)
To: Joe.Ghalam; +Cc: davem, Clifford.Wichmann, netdev
In-Reply-To: <1492785652578.53801@Dell.com>
On Fri, Apr 21, 2017 at 02:40:50PM +0000, Joe.Ghalam@dell.com wrote:
> That's not true. macvlan_dellink() unregisters the queue, and macvlan_process_broadcast() will never get called. Please note that I'm not speculating. I have traced enabled on the dev_put and dev_hold, and I'm reporting a real, reproducible issue.
The only thing that can stop macvlan_process_broadcast from getting
called is macvlan_port_destroy. Nothing else can stop the work
queue, unless of course the work queue mechanism itself is broken.
So if you're sure macvlan_port_destroy is never even called in
your case, then you'll need to start debugging the kernel work
queue mechanism to see why macvlan_process_broadcast is not getting
called.
Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* Re: [PATCH iproute2 net 3/8] tc/pedit: Introduce 'add' operation
From: Amir Vadai @ 2017-04-24 7:52 UTC (permalink / raw)
To: Jamal Hadi Salim; +Cc: Stephen Hemminger, netdev, Or Gerlitz
In-Reply-To: <f358025b-2618-3f22-b593-2e4e70fb7a79@mojatatu.com>
On Sun, Apr 23, 2017 at 01:44:51PM -0400, Jamal Hadi Salim wrote:
>
> Thanks for the excellent work.
>
> On 17-04-23 08:53 AM, Amir Vadai wrote:
> > This command could be useful to increase/decrease fields value.
> >
>
> Does this contradict the "retain" feature? Example rule to
> retain the second nibble but set the first to 0xA
> (essentially it X-ORs):
> tc filter add dev lo parent ffff: protocol ip prio 10 \
> u32 match ip dst 127.0.0.1/32 flowid 1:1 \
> action pedit munge offset 0 u8 set 0x0A retain 0xF0
You mean, for example increasing a single nible in an ipv4 address?
If so, then it should work:
# tc filter add dev veth0 parent ffff: u32 \
match ip dport 23 0xffff \
action pedit ex \
munge ip src add 1.0.0.0 retain 0xff000000
# tc -s filter show dev veth0 parent ffff:
filter protocol all pref 49151 u32
filter protocol all pref 49151 u32 fh 801: ht divisor 1
filter protocol all pref 49151 u32 fh 801::800 order 2048 key ht 801 bkt 0 terminal flowid ??? (rule hit 0 success 0)
match 00000017/0000ffff at 20 (success 0 )
action order 1: pedit action pass keys 1
index 48 ref 1 bind 1 installed 1 sec used 1 sec
key #0 at ipv4+12: add 01000000 mask 00ffffff
Action statistics:
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
>
> Mostly curious about hardware handling.
As to hardware handling, Or did the implementation so he will answer
better. AFAIK, current implementation doesn't allow partial field
setting/adding, so such a rule can't be offloaded. I think it is only to
make things simple and because there was no use case for that.
To my knowledge, hardware should support such thing if needed.
Amir
>
> cheers,
> jamal
>
^ permalink raw reply
* [PATCH net] xfrm: do the garbage collection after flushing policy
From: Xin Long @ 2017-04-24 7:33 UTC (permalink / raw)
To: network dev; +Cc: davem, Herbert Xu, fw
Now xfrm garbage collection can be triggered by 'ip xfrm policy del'.
These is no reason not to do it after flushing policies, especially
considering that 'garbage collection deferred' is only triggered
when it reaches gc_thresh.
It's no good that the policy is gone but the xdst still hold there.
The worse thing is that xdst->route/orig_dst is also hold and can
not be released even if the orig_dst is already expired.
This patch is to do the garbage collection if there is any policy
removed in xfrm_policy_flush.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
net/xfrm/xfrm_policy.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 236cbbc..dfc77b9 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1006,6 +1006,10 @@ int xfrm_policy_flush(struct net *net, u8 type, bool task_valid)
err = -ESRCH;
out:
spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
+
+ if (cnt)
+ xfrm_garbage_collect(net);
+
return err;
}
EXPORT_SYMBOL(xfrm_policy_flush);
--
2.1.0
^ permalink raw reply related
* [PATCH net] bridge: shutdown bridge device before removing it
From: Xin Long @ 2017-04-24 7:25 UTC (permalink / raw)
To: network dev; +Cc: davem, nikolay
During removing a bridge device, if the bridge is still up, a new mdb entry
still can be added in br_multicast_add_group() after all mdb entries are
removed in br_multicast_dev_del(). Like the path:
mld_ifc_timer_expire ->
mld_sendpack -> ...
br_multicast_rcv ->
br_multicast_add_group
The new mp's timer will be set up. If the timer expires after the bridge
is freed, it may cause use-after-free panic in br_multicast_group_expired.
This can happen when ip link remove a bridge or destroy a netns with a
bridge device inside.
As we can see in br_del_bridge, brctl is also supposed to remove a bridge
device after it's shutdown.
This patch is to call dev_close at the beginning of br_dev_delete so that
netif_running check in br_multicast_add_group can avoid this issue. But
to keep consistent with before, it will not remove the IFF_UP check in
br_del_bridge for brctl.
Reported-by: Jianwen Ji <jiji@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
net/bridge/br_if.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 56a2a72..8175f13 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -305,6 +305,8 @@ void br_dev_delete(struct net_device *dev, struct list_head *head)
struct net_bridge *br = netdev_priv(dev);
struct net_bridge_port *p, *n;
+ dev_close(br->dev);
+
list_for_each_entry_safe(p, n, &br->port_list, list) {
del_nbp(p);
}
--
2.1.0
^ permalink raw reply related
* Re: [PATCH] ipvs: explicitly forbid ipv6 service/dest creation if ipv6 mod is disabled
From: Julian Anastasov @ 2017-04-24 7:21 UTC (permalink / raw)
To: Paolo Abeni
Cc: netfilter-devel, lvs-devel, Wensong Zhang, Simon Horman, netdev
In-Reply-To: <1493016651.5744.1.camel@redhat.com>
Hello,
On Mon, 24 Apr 2017, Paolo Abeni wrote:
> Hi,
>
> The problem with the patched code is that it tries to resolve ipv6
> addresses that are not created/validated by the kernel.
OK. Simon, please apply to ipvs tree.
Acked-by: Julian Anastasov <ja@ssi.bg>
Regards
--
Julian Anastasov <ja@ssi.bg>
^ permalink raw reply
* Re: [PATCH 2/2] net: team: fix memory leak in team_nl_send_options_get
From: Jiri Pirko @ 2017-04-24 7:11 UTC (permalink / raw)
To: Pan Bian; +Cc: netdev, linux-kernel
In-Reply-To: <1493017495-3578-1-git-send-email-bianpan2016@163.com>
Mon, Apr 24, 2017 at 09:04:55AM CEST, bianpan2016@163.com wrote:
>In function team_nl_send_options_get(), pointer skb keeps the return
>value of function nlmsg_new(). When the call to genlmsg_put() fails, the
>control flow directly returns and does not free skb. This will result in
>a memory leak bug. This patch fixes it.
>
>Fixes: 8ea7fd0d8792 ("team: fix memory leak")
test1:~/net-next$ git log 8ea7fd0d8792
fatal: ambiguous argument '8ea7fd0d8792': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Please look up the commit that introduces the issue. Also no newline
in between "fixes" and "signed off".
Also. The subject should be:
[PATCH net 2/2] team: fix memory leak in team_nl_send_options_get
You can see this right away if you look in the mailing list archive...
>
>Signed-off-by: Pan Bian <bianpan2016@163.com>
>---
> drivers/net/team/team.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
>index dd3a2e9..85c0124 100644
>--- a/drivers/net/team/team.c
>+++ b/drivers/net/team/team.c
>@@ -2361,8 +2361,10 @@ static int team_nl_send_options_get(struct team *team, u32 portid, u32 seq,
>
> hdr = genlmsg_put(skb, portid, seq, &team_nl_family, flags | NLM_F_MULTI,
> TEAM_CMD_OPTIONS_GET);
>- if (!hdr)
>+ if (!hdr) {
>+ nlmsg_free(skb);
> return -EMSGSIZE;
>+ }
>
> if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex))
> goto nla_put_failure;
>--
>1.9.1
>
>
^ permalink raw reply
* Re: [PATCH net-next 2/2] cls_flower: add support for matching MPLS fields (v2)
From: Jiri Pirko @ 2017-04-24 7:07 UTC (permalink / raw)
To: Benjamin LaHaise
Cc: netdev, Benjamin LaHaise, David S. Miller, Simon Horman,
Jamal Hadi Salim, Cong Wang, Jiri Pirko, Eric Dumazet,
Hadar Hen Zion, Gao Feng
In-Reply-To: <1492894367-11637-3-git-send-email-benjamin.lahaise@netronome.com>
Sat, Apr 22, 2017 at 10:52:47PM CEST, benjamin.lahaise@netronome.com wrote:
>Add support to the tc flower classifier to match based on fields in MPLS
>labels (TTL, Bottom of Stack, TC field, Label).
>
>Signed-off-by: Benjamin LaHaise <benjamin.lahaise@netronome.com>
>Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
>Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
^ permalink raw reply
* Re: [PATCH net-next 1/2] flow_dissector: add mpls support (v2)
From: Jiri Pirko @ 2017-04-24 7:05 UTC (permalink / raw)
To: Benjamin LaHaise
Cc: netdev, Benjamin LaHaise, David S. Miller, Simon Horman,
Jamal Hadi Salim, Cong Wang, Jiri Pirko, Hadar Hen Zion, Gao Feng
In-Reply-To: <1492894367-11637-2-git-send-email-benjamin.lahaise@netronome.com>
Sat, Apr 22, 2017 at 10:52:46PM CEST, benjamin.lahaise@netronome.com wrote:
>Add support for parsing MPLS flows to the flow dissector in preparation for
>adding MPLS match support to cls_flower.
>
>Signed-off-by: Benjamin LaHaise <benjamin.lahaise@netronome.com>
>Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
This looks odd :)
>Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
^ permalink raw reply
* [PATCH 2/2] net: team: fix memory leak in team_nl_send_options_get
From: Pan Bian @ 2017-04-24 7:04 UTC (permalink / raw)
To: Jiri Pirko, netdev; +Cc: linux-kernel, Pan Bian
In function team_nl_send_options_get(), pointer skb keeps the return
value of function nlmsg_new(). When the call to genlmsg_put() fails, the
control flow directly returns and does not free skb. This will result in
a memory leak bug. This patch fixes it.
Fixes: 8ea7fd0d8792 ("team: fix memory leak")
Signed-off-by: Pan Bian <bianpan2016@163.com>
---
drivers/net/team/team.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index dd3a2e9..85c0124 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -2361,8 +2361,10 @@ static int team_nl_send_options_get(struct team *team, u32 portid, u32 seq,
hdr = genlmsg_put(skb, portid, seq, &team_nl_family, flags | NLM_F_MULTI,
TEAM_CMD_OPTIONS_GET);
- if (!hdr)
+ if (!hdr) {
+ nlmsg_free(skb);
return -EMSGSIZE;
+ }
if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex))
goto nla_put_failure;
--
1.9.1
^ permalink raw reply related
* [PATCH 1/2] net: team: fix memory leak in team_nl_send_port_list_get
From: Pan Bian @ 2017-04-24 7:04 UTC (permalink / raw)
To: Jiri Pirko, netdev; +Cc: linux-kernel, Pan Bian
In function team_nl_send_port_list_get(), pointer skb keeps the return
value of nlmsg_new(). When the call to genlmsg_put() fails, the memory
is not freed. This will result in a memory leak bug. This patch fixes
it.
Fixes: fbd69cda90e7 ("team: fix memory leak")
Signed-off-by: Pan Bian <bianpan2016@163.com>
---
drivers/net/team/team.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index f8c81f1..dd3a2e9 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -2634,8 +2634,10 @@ static int team_nl_send_port_list_get(struct team *team, u32 portid, u32 seq,
hdr = genlmsg_put(skb, portid, seq, &team_nl_family, flags | NLM_F_MULTI,
TEAM_CMD_PORT_LIST_GET);
- if (!hdr)
+ if (!hdr) {
+ nlmsg_free(skb);
return -EMSGSIZE;
+ }
if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex))
goto nla_put_failure;
--
1.9.1
^ permalink raw reply related
* Re: [PATCH] ipvs: explicitly forbid ipv6 service/dest creation if ipv6 mod is disabled
From: Paolo Abeni @ 2017-04-24 6:50 UTC (permalink / raw)
To: Julian Anastasov
Cc: netfilter-devel, lvs-devel, Wensong Zhang, Simon Horman, netdev
In-Reply-To: <alpine.LFD.2.20.1704221355290.1974@ja.home.ssi.bg>
Hi,
On Sat, 2017-04-22 at 14:16 +0300, Julian Anastasov wrote:
> On Thu, 20 Apr 2017, Paolo Abeni wrote:
>
> > When creating a new ipvs service, ipv6 addresses are always accepted
> > if CONFIG_IP_VS_IPV6 is enabled. On dest creation the address family
> > is not explicitly checked.
> >
> > This allows the user-space to configure ipvs services even if the
> > system is booted with ipv6.disable=1. On specific configuration, ipvs
> > can try to call ipv6 routing code at setup time, causing the kernel to
> > oops due to fib6_rules_ops being NULL.
> >
> > This change addresses the issue adding a check for the ipv6
> > module being enabled while validating ipv6 service operations and
> > adding the same validation for dest operations.
> >
> > According to git history, this issue is apparently present since
> > the introduction of ipv6 support, and the oops can be triggered
> > since commit 09571c7ae30865ad ("IPVS: Add function to determine
> > if IPv6 address is local")
> >
> > Fixes: 09571c7ae30865ad ("IPVS: Add function to determine if IPv6 address is local")
> > Signed-off-by: Paolo Abeni <pabeni@redhat.com>
>
> Looks good to me but I see two places that can benefit
> from such check:
I'm sorry for the lag, I was delayed by other notorious issues ;-)
I'm unable to trigger any crash with the patched kernel.
> - in ip_vs_genl_new_daemon() if we do not want to create IPv6 sockets
> for the sync protocol in make_send_sock() and make_receive_sock().
> Not sure if this can lead to crashes.
This one is, AFAICS, safe, because ip_vs_genl_new_daemon() calls
start_sync_thread(), which tries to create a socket of the specified
address family before doing any real action. Such operation will fail
gracefully, and overall we will get an - expected - error to userspace.
> - in ip_vs_proc_sync_conn() if we do not want backup server to accept
> IPv6 conns because they may be created even when dests are missing.
> We may use retc = 10 there. Not fatal but may eat memory for
> conns that will not be used.
If I read the above correct correctly, even that should be safe, for
the same reason: ipv6 socket creation will fail if ipv6 is disabled.
The problem with the patched code is that it tries to resolve ipv6
addresses that are not created/validated by the kernel.
Cheers,
Paolo
^ permalink raw reply
* Re: [ISSUE: sky2 - rx error] Link stops working under heavy traffic load connected to a mv88e6176
From: Rafa Corvillo @ 2017-04-24 6:45 UTC (permalink / raw)
To: netdev
In-Reply-To: <58F9FD64.80506@aoifes.com>
I resend the mail with the schema fixed. Sorry for the inconvenience.
We are working in an ARMv7 embedded system running kernel 4.9 (LEDE build).
It is an imx6 board with 2 ethernet interfaces. One of them is connected to
a Marvell switch.
The schema of the system is the following:
+-------------------+ eth0
| +--+
| | |
| Embedded system +--+
| |
| ARMv7 |
| | Marvell 88E8057(sky2) +-------------+
| +--+ +--+ +--+ eth1
| | +---------------------+ | | +------+
| +--+ CPU port +--+ mv88e6176 +--+
+------+--+---------+ | |
emulated| | | |
GPIO +--+ +--+ +--+ eth2
MDIO +-----------------------------------+ | | +------+
MDIO +--+ +--+
+-------------+
There is a bridge (br-lan) which includes eth0/eth1/eth2
If I connect the eth1/eth2, the link is up and I can do ping through it.
But, once
I start sending a heavy traffic load the link fails and the kernel sends
the
following messages:
[ 48.557140] sky2 0000:04:00.0 marvell: rx error, status 0x5f20010
length 1518
[ 48.564964] sky2 0000:04:00.0 marvell: rx error, status 0x5f20010
length 1518
[ 48.572110] sky2 0000:04:00.0 marvell: rx error, status 0x5f20010
length 1518
[ 48.579263] sky2 0000:04:00.0 marvell: rx error, status 0x5f20010
length 1518
[ 48.586417] sky2 0000:04:00.0 marvell: rx error, status 0x5f20010
length 1518
[ 48.593573] sky2 0000:04:00.0 marvell: rx error, status 0x5f20010
length 1518
[ 48.600718] sky2 0000:04:00.0 marvell: rx error, status 0x5f20010
length 1518
[ 54.877567] net_ratelimit: 6 callbacks suppressed
[ 54.882293] sky2 0000:04:00.0 marvell: rx error, status 0x5f20010
length 1518
[ 61.413552] sky2 0000:04:00.0 marvell: rx error, status 0x5f20010
length 1518
I have a modified device-tree of imx6 which includes the mdio and dsa
nodes. This
device-tree works in a kernel 4.1.6, but I know that these parts of the
kernel have
a lot of changes. The changes included for mdio and dsa in the
device-tree are the
following (diff arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
arch/arm/boot/dts/imx6qdl-gw53xx-mdio.dtsi):
16a17,18
> can0 = &can1;
> ethernet0 = &fec;
21a24
> sky2 = ð1;
24a28,29
> usdhc2 = &usdhc3;
> mdio-gpio0 = &mdio0;
62a68,125
> mdio0: mdio {
> compatible = "virtual,mdio-gpio";
> #address-cells = <1>;
> #size-cells = <0>;
> /* MDC = gpio-17, MDIO = gpio-20 */
> gpios = <&gpio1 17 1
> &gpio1 20 0>;
> ethernet-phy@0 {
> compatible = "marvell,dsa";
> };
> };
>
> dsa {
> compatible = "marvell,dsa";
> #address-cells = <2>;
> #size-cells = <0>;
>
> interrupts = <10>;
> dsa,ethernet = <ð1>;
> dsa,mii-bus = <&mdio0>;
>
> switch@0 {
> #address-cells = <1>;
> #size-cells = <0>;
> reg = <0 0>; /* MDIO address 0, switch 0 in tree */
>
> port@0 {
> reg = <0>;
> label = "cpu";
> };
>
> port@1 {
> reg = <1>;
> label = "eth1";
> };
>
> port@2 {
> reg = <2>;
> label = "eth2";
> };
>
> port@3 {
> reg = <3>;
> label = "eth3";
> };
>
> port@4 {
> reg = <4>;
> label = "eth4";
> };
> };
> };
>
361a425,430
> &mdio0 {
> pinctrl-names = "default";
> pinctrl-0 = <&pinctrl_mdio>;
> status = "okay";
> };
>
363c432
< imx6qdl-gw53xx {
---
> imx6qdl-gw53xx-mdio {
448a518,524
> >;
> };
>
> pinctrl_mdio: mdiogrp {
> fsl,pins = <
> MX6QDL_PAD_SD1_DAT1__GPIO1_IO17 0x1b0b9
> MX6QDL_PAD_SD1_CLK__GPIO1_IO20 0x1b0b9
Do you know of any possible reason why this could be happening?
Thanks in advance.
Rafa
^ permalink raw reply
* Re: [PATCH v3 07/29] x86: bpf_jit, use ENTRY+ENDPROC
From: Jiri Slaby @ 2017-04-24 6:45 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: mingo, tglx, hpa, x86, jpoimboe, linux-kernel, David S. Miller,
netdev, Daniel Borkmann, Eric Dumazet
In-Reply-To: <20170421193213.GB91454@ast-mbp.thefacebook.com>
On 04/21/2017, 09:32 PM, Alexei Starovoitov wrote:
> On Fri, Apr 21, 2017 at 04:12:43PM +0200, Jiri Slaby wrote:
>> Do not use a custom macro FUNC for starts of the global functions, use
>> ENTRY instead.
>>
>> And while at it, annotate also ends of the functions by ENDPROC.
>>
>> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
>> Cc: "David S. Miller" <davem@davemloft.net>
>> Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
>> Cc: James Morris <jmorris@namei.org>
>> Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
>> Cc: Patrick McHardy <kaber@trash.net>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Cc: Ingo Molnar <mingo@redhat.com>
>> Cc: "H. Peter Anvin" <hpa@zytor.com>
>> Cc: x86@kernel.org
>> Cc: netdev@vger.kernel.org
>> ---
>> arch/x86/net/bpf_jit.S | 32 ++++++++++++++++++--------------
>> 1 file changed, 18 insertions(+), 14 deletions(-)
>>
>> diff --git a/arch/x86/net/bpf_jit.S b/arch/x86/net/bpf_jit.S
>> index f2a7faf4706e..762c29fb8832 100644
>> --- a/arch/x86/net/bpf_jit.S
>> +++ b/arch/x86/net/bpf_jit.S
>> @@ -23,16 +23,12 @@
>> 32 /* space for rbx,r13,r14,r15 */ + \
>> 8 /* space for skb_copy_bits */)
>>
>> -#define FUNC(name) \
>> - .globl name; \
>> - .type name, @function; \
>> - name:
>> -
>> -FUNC(sk_load_word)
>> +ENTRY(sk_load_word)
>> test %esi,%esi
>> js bpf_slow_path_word_neg
>> +ENDPROC(sk_load_word)
>
> this doens't look right.
> It will add alignment nops in critical paths of these pseudo functions.
> I'm also not sure whether it will still work afterwards.
> Was it tested?
> I'd prefer if this code kept as-is.
It cannot stay as-is simply because we want to know where the functions
end to inject debuginfo properly. The code above does not warrant for
any exception.
Executing a nop takes a little and having externally-callable functions
aligned can actually help performance (no, I haven't measured nor tested
the code). But sure, the tool is generic, so I can introduce a local
macros to avoid alignments in the functions:
#define BPF_FUNC_START_LOCAL(name) \
SYM_START(name, SYM_V_LOCAL, SYM_A_NONE)
#define BPF_FUNC_START(name) \
SYM_START(name, SYM_V_GLOBAL, SYM_A_NONE)
#define BPF_FUNC_END(name) SYM_FUNC_END(name)
thanks,
--
js
suse labs
^ permalink raw reply
* Re: [PATCH 1/2] team: fix memory leak
From: Jiri Pirko @ 2017-04-24 5:40 UTC (permalink / raw)
To: Pan Bian; +Cc: netdev, linux-kernel
In-Reply-To: <1492932564-722-1-git-send-email-bianpan2016@163.com>
Sun, Apr 23, 2017 at 09:29:24AM CEST, bianpan2016@163.com wrote:
>In function team_nl_send_port_list_get(), pointer skb keeps the return
>value of nlmsg_new(). When the call to genlmsg_put() fails, the memory
>is not freed. This will result in a memory leak bug. This patch fixes
>it.
>
Looks good. Please adjust subject so the both patches have a specific
one. Also, please add "Fixes" tag (see git log for details).
Also, is is good to say which tree this patches are generated against
("-net")
>Signed-off-by: Pan Bian <bianpan2016@163.com>
>---
> drivers/net/team/team.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
>index f8c81f1..dd3a2e9 100644
>--- a/drivers/net/team/team.c
>+++ b/drivers/net/team/team.c
>@@ -2634,8 +2634,10 @@ static int team_nl_send_port_list_get(struct team *team, u32 portid, u32 seq,
>
> hdr = genlmsg_put(skb, portid, seq, &team_nl_family, flags | NLM_F_MULTI,
> TEAM_CMD_PORT_LIST_GET);
>- if (!hdr)
>+ if (!hdr) {
>+ nlmsg_free(skb);
> return -EMSGSIZE;
>+ }
>
> if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex))
> goto nla_put_failure;
>--
>1.9.1
>
>
^ permalink raw reply
* Regarding patch: vlan: avoid a synchronize_net when parent device goes down
From: prasad padiyar @ 2017-04-24 5:10 UTC (permalink / raw)
To: netdev
Hi,
I had a query regarding the patch in the subject line.
>From the patch pasted below
vlan = vlan_dev_priv(vlandev);
if (!(vlan->flags & VLAN_FLAG_LOOSE_BINDING))
- dev_change_flags(vlandev, flgs & ~IFF_UP);
+ list_add(&vlandev->close_list, &close_list);
+ }
+
+ dev_close_many(&close_list, false);
+
+ list_for_each_entry_safe(vlandev, tmp, &close_list, close_list) {
netif_stacked_transfer_operstate(dev, vlandev);
+ list_del_init(&vlandev->close_list);
}
+ list_del(&close_list);
"
if (!(vlan->flags & VLAN_FLAG_LOOSE_BINDING))
- dev_change_flags(vlandev, flgs & ~IFF_UP);
+ list_add(&vlandev->close_list, &close_list);
+ }
+
+ dev_close_many(&close_list, false);
+
+ list_for_each_entry_safe(vlandev, tmp, &close_list, close_list) {
netif_stacked_transfer_operstate(dev, vlandev);
+ list_del_init(&vlandev->close_list);
}
+ list_del(&close_list);.
i can see that dev_change_flags which was setting the vlan device to
down state in case VLAN_FLAG_LOOSE_BINDING was not enabled.
But setting the operstate when the VLAN real device goes admin down
was quite independent of VLAN_FLAG_LOOSE_BINDING.
Operstate was always getting transferred irrespective of LOOSE_BINDING flag.
But now with this patch, we see that control of transferring the
operstate is based of VLAN_FLAG_LOOSE_BINDING. If
VLAN_FLAG_LOOSE_BINDING is set then oper state is not changed as per
its real iface.
Is this the expected behavior. Does VLAN_FLAG_LOOSE_BINDING with this
patch has to control the operstate as well which was not
the case earlier without this patch. ?
Can someone share your views about this.
Kernel version: 4.4.20
patch link:
https://patchwork.ozlabs.org/patch/447837/
--
Regards,
Prasad
^ permalink raw reply
* Re: [PATCH 1/2] ixgbe: add XDP support for pass and drop actions
From: John Fastabend @ 2017-04-24 4:26 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: jeffrey.t.kirsher, netdev
In-Reply-To: <20170423210506.79168335@laptop>
On 17-04-23 09:05 PM, Jakub Kicinski wrote:
> Hi!
>
> On Sun, 23 Apr 2017 18:31:19 -0700, John Fastabend wrote:
>> +static int ixgbe_xdp_setup(struct net_device *dev, struct bpf_prog *prog)
>> +{
>> + int i, frame_size = dev->mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
>> + struct ixgbe_adapter *adapter = netdev_priv(dev);
>> + struct bpf_prog *old_prog;
>> +
>> + if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)
>> + return -EINVAL;
>> +
>> + if (adapter->flags & IXGBE_FLAG_DCB_ENABLED)
>> + return -EINVAL;
>> +
>> + /* verify ixgbe ring attributes are sufficient for XDP */
>> + for (i = 0; i < adapter->num_rx_queues; i++) {
>> + struct ixgbe_ring *ring = adapter->rx_ring[i];
>> +
>> + if (ring_is_rsc_enabled(ring))
>> + return -EINVAL;
>> +
>> + if (frame_size > ixgbe_rx_bufsz(ring))
>> + return -EINVAL;
>> + }
>
> I was just looking through the drivers, working on extended ack
> reporting, trying to bring out the driver XDP error messages out
> directly to iproute2. It seems that multiple drivers are only
> checking that MTU/buffer size is appropriate in the XDP_SETUP
> function, and ignore XDP in case user tries to change MTU later.
> And I think it's the same story with LRO?
>
Agreed we need to harden the drivers to changes post XDP init. I'll submit
a few follow on patches for the ixgbe devices in the morning.
Thanks,
John
^ permalink raw reply
* Re: [PATCH 1/2] ixgbe: add XDP support for pass and drop actions
From: Jakub Kicinski @ 2017-04-24 4:05 UTC (permalink / raw)
To: John Fastabend; +Cc: jeffrey.t.kirsher, netdev
In-Reply-To: <20170424013119.8354.18750.stgit@john-Precision-Tower-5810>
Hi!
On Sun, 23 Apr 2017 18:31:19 -0700, John Fastabend wrote:
> +static int ixgbe_xdp_setup(struct net_device *dev, struct bpf_prog *prog)
> +{
> + int i, frame_size = dev->mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
> + struct ixgbe_adapter *adapter = netdev_priv(dev);
> + struct bpf_prog *old_prog;
> +
> + if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)
> + return -EINVAL;
> +
> + if (adapter->flags & IXGBE_FLAG_DCB_ENABLED)
> + return -EINVAL;
> +
> + /* verify ixgbe ring attributes are sufficient for XDP */
> + for (i = 0; i < adapter->num_rx_queues; i++) {
> + struct ixgbe_ring *ring = adapter->rx_ring[i];
> +
> + if (ring_is_rsc_enabled(ring))
> + return -EINVAL;
> +
> + if (frame_size > ixgbe_rx_bufsz(ring))
> + return -EINVAL;
> + }
I was just looking through the drivers, working on extended ack
reporting, trying to bring out the driver XDP error messages out
directly to iproute2. It seems that multiple drivers are only
checking that MTU/buffer size is appropriate in the XDP_SETUP
function, and ignore XDP in case user tries to change MTU later.
And I think it's the same story with LRO?
^ permalink raw reply
* Re: [PATCH 1/1] mt7601u: check return value of alloc_skb
From: Jakub Kicinski @ 2017-04-24 3:49 UTC (permalink / raw)
To: Pan Bian
Cc: Kalle Valo, Matthias Brugger, linux-wireless, netdev,
linux-kernel, linux-arm-kernel, linux-mediatek
In-Reply-To: <1492930823-17249-1-git-send-email-bianpan2016@163.com>
On Sun, 23 Apr 2017 15:00:23 +0800, Pan Bian wrote:
> Function alloc_skb() will return a NULL pointer if there is no enough
> memory. However, in function mt7601u_mcu_msg_alloc(), its return value
> is not validated before it is used. This patch fixes it.
>
> Signed-off-by: Pan Bian <bianpan2016@163.com>
Acked-by: Jakub Kicinski <kubakici@wp.pl>
Thanks!
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox