* [PATCH bpf-next v2] bpf, seccomp: fix false positive preemption splat for cbpf->ebpf progs
From: Daniel Borkmann @ 2019-02-20 23:01 UTC (permalink / raw)
To: ast; +Cc: keescook, netdev, Daniel Borkmann
In 568f196756ad ("bpf: check that BPF programs run with preemption disabled")
a check was added for BPF_PROG_RUN() that for every invocation preemption is
disabled to not break eBPF assumptions (e.g. per-cpu map). Of course this does
not count for seccomp because only cBPF -> eBPF is loaded here and it does
not make use of any functionality that would require this assertion. Fix this
false positive by adding and using SECCOMP_RUN() variant that does not have
the cant_sleep(); check.
Fixes: 568f196756ad ("bpf: check that BPF programs run with preemption disabled")
Reported-by: syzbot+8bf19ee2aa580de7a2a7@syzkaller.appspotmail.com
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Kees Cook <keescook@chromium.org>
---
v1 -> v2:
- More elaborate comment and added SECCOMP_RUN
- Added Kees' ACK from earlier v1 patch
include/linux/filter.h | 22 +++++++++++++++++++++-
kernel/seccomp.c | 2 +-
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/include/linux/filter.h b/include/linux/filter.h
index f32b3ec..cd7f957 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -533,7 +533,27 @@ struct sk_filter {
struct bpf_prog *prog;
};
-#define BPF_PROG_RUN(filter, ctx) ({ cant_sleep(); (*(filter)->bpf_func)(ctx, (filter)->insnsi); })
+#define __bpf_prog_run(prog, ctx) \
+ (*(prog)->bpf_func)(ctx, (prog)->insnsi)
+#define __bpf_prog_run__may_preempt(prog, ctx) \
+ ({ __bpf_prog_run(prog, ctx); })
+#define __bpf_prog_run__non_preempt(prog, ctx) \
+ ({ cant_sleep(); __bpf_prog_run(prog, ctx); })
+
+/* Preemption must be disabled when native eBPF programs are run in
+ * order to not break per CPU data structures, for example; make
+ * sure to throw a stack trace under CONFIG_DEBUG_ATOMIC_SLEEP when
+ * we find that preemption is still enabled.
+ *
+ * Only exception today is seccomp, where progs have transitioned
+ * from cBPF to eBPF, and native eBPF is _not_ supported. They can
+ * safely run with preemption enabled.
+ */
+#define BPF_PROG_RUN(prog, ctx) \
+ __bpf_prog_run__non_preempt(prog, ctx)
+
+#define SECCOMP_RUN(prog, ctx) \
+ __bpf_prog_run__may_preempt(prog, ctx)
#define BPF_SKB_CB_LEN QDISC_CB_PRIV_LEN
diff --git a/kernel/seccomp.c b/kernel/seccomp.c
index e815781..701a3cf 100644
--- a/kernel/seccomp.c
+++ b/kernel/seccomp.c
@@ -268,7 +268,7 @@ static u32 seccomp_run_filters(const struct seccomp_data *sd,
* value always takes priority (ignoring the DATA).
*/
for (; f; f = f->prev) {
- u32 cur_ret = BPF_PROG_RUN(f->prog, sd);
+ u32 cur_ret = SECCOMP_RUN(f->prog, sd);
if (ACTION_ONLY(cur_ret) < ACTION_ONLY(ret)) {
ret = cur_ret;
--
2.9.5
^ permalink raw reply related
* Re: [PATCH net-next v4 1/3] net: dsa: add support for bridge flags
From: Florian Fainelli @ 2019-02-20 23:18 UTC (permalink / raw)
To: Russell King, Andrew Lunn, Vivien Didelot
Cc: Heiner Kallweit, David S. Miller, netdev
In-Reply-To: <E1gwYuI-0001aX-2u@rmk-PC.armlinux.org.uk>
On 2/20/19 12:55 PM, Russell King wrote:
> The Linux bridge implementation allows various properties of the bridge
> to be controlled, such as flooding unknown unicast and multicast frames.
> This patch adds the necessary DSA infrastructure to allow the Linux
> bridge support to control these properties for DSA switches.
>
> Reviewed-by: Vivien Didelot <vivien.didelot@gmail.com>
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
> ---
> include/net/dsa.h | 2 ++
> net/dsa/dsa_priv.h | 2 ++
> net/dsa/port.c | 17 +++++++++++++++++
> net/dsa/slave.c | 6 ++++++
> 4 files changed, 27 insertions(+)
>
> diff --git a/include/net/dsa.h b/include/net/dsa.h
> index 7f2a668ef2cc..2c2c10812814 100644
> --- a/include/net/dsa.h
> +++ b/include/net/dsa.h
> @@ -400,6 +400,8 @@ struct dsa_switch_ops {
> void (*port_stp_state_set)(struct dsa_switch *ds, int port,
> u8 state);
> void (*port_fast_age)(struct dsa_switch *ds, int port);
> + int (*port_egress_floods)(struct dsa_switch *ds, int port,
> + bool unicast, bool multicast);
>
> /*
> * VLAN support
> diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
> index 1f4972dab9f2..f4f99ec29f5d 100644
> --- a/net/dsa/dsa_priv.h
> +++ b/net/dsa/dsa_priv.h
> @@ -160,6 +160,8 @@ int dsa_port_mdb_add(const struct dsa_port *dp,
> struct switchdev_trans *trans);
> int dsa_port_mdb_del(const struct dsa_port *dp,
> const struct switchdev_obj_port_mdb *mdb);
> +int dsa_port_bridge_flags(const struct dsa_port *dp, unsigned long flags,
> + struct switchdev_trans *trans);
> int dsa_port_vlan_add(struct dsa_port *dp,
> const struct switchdev_obj_port_vlan *vlan,
> struct switchdev_trans *trans);
> diff --git a/net/dsa/port.c b/net/dsa/port.c
> index 2d7e01b23572..6df29bddf37e 100644
> --- a/net/dsa/port.c
> +++ b/net/dsa/port.c
> @@ -177,6 +177,23 @@ int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock,
> return dsa_port_notify(dp, DSA_NOTIFIER_AGEING_TIME, &info);
> }
>
> +int dsa_port_bridge_flags(const struct dsa_port *dp, unsigned long flags,
> + struct switchdev_trans *trans)
> +{
> + struct dsa_switch *ds = dp->ds;
> + int port = dp->index;
> + int err = 0;
> +
> + if (switchdev_trans_ph_prepare(trans))
> + return 0;
> +
> + if (ds->ops->port_egress_floods)
> + err = ds->ops->port_egress_floods(ds, port, flags & BR_FLOOD,
> + flags & BR_MCAST_FLOOD);
> +
> + return err;
> +}
> +
> int dsa_port_fdb_add(struct dsa_port *dp, const unsigned char *addr,
> u16 vid)
> {
> diff --git a/net/dsa/slave.c b/net/dsa/slave.c
> index 2e5e7c04821b..f99161c3b1ea 100644
> --- a/net/dsa/slave.c
> +++ b/net/dsa/slave.c
> @@ -295,6 +295,9 @@ static int dsa_slave_port_attr_set(struct net_device *dev,
> case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME:
> ret = dsa_port_ageing_time(dp, attr->u.ageing_time, trans);
> break;
> + case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
> + ret = dsa_port_bridge_flags(dp, attr->u.brport_flags, trans);
> + break;
> default:
> ret = -EOPNOTSUPP;
> break;
> @@ -384,6 +387,9 @@ static int dsa_slave_port_attr_get(struct net_device *dev,
> switch (attr->id) {
> case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT:
> attr->u.brport_flags_support = 0;
> + if (ds->ops->port_egress_floods)
> + attr->u.brport_flags_support |= BR_FLOOD |
> + BR_MCAST_FLOOD;
There is no struct dsa_switch *ds = dp->ds that is being declared in
dsa_slave_port_attr_get():
net/dsa/slave.c: In function 'dsa_slave_port_attr_get':
net/dsa/slave.c:390:7: error: 'ds' undeclared (first use in this function)
if (ds->ops->port_egress_floods)
^~
net/dsa/slave.c:390:7: note: each undeclared identifier is reported only
once for each function it appears in
scripts/Makefile.build:276: recipe for target 'net/dsa/slave.o' failed
make[4]: *** [net/dsa/slave.o] Error 1
scripts/Makefile.build:492: recipe for target 'net/dsa' failed
make[3]: *** [net/dsa] Error 2
make[3]: *** Waiting for unfinished jobs....
--
Florian
^ permalink raw reply
* Re: [PATCH net-next v4 1/3] net: dsa: add support for bridge flags
From: Russell King - ARM Linux admin @ 2019-02-20 23:23 UTC (permalink / raw)
To: Florian Fainelli
Cc: Andrew Lunn, Vivien Didelot, Heiner Kallweit, David S. Miller,
netdev
In-Reply-To: <6542d026-5c68-56fe-a0c5-47f7a1e2f0fa@gmail.com>
Hi Florian,
Please take over these patches.
Thanks.
On Wed, Feb 20, 2019 at 03:18:44PM -0800, Florian Fainelli wrote:
> On 2/20/19 12:55 PM, Russell King wrote:
> > The Linux bridge implementation allows various properties of the bridge
> > to be controlled, such as flooding unknown unicast and multicast frames.
> > This patch adds the necessary DSA infrastructure to allow the Linux
> > bridge support to control these properties for DSA switches.
> >
> > Reviewed-by: Vivien Didelot <vivien.didelot@gmail.com>
> > Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
> > ---
> > include/net/dsa.h | 2 ++
> > net/dsa/dsa_priv.h | 2 ++
> > net/dsa/port.c | 17 +++++++++++++++++
> > net/dsa/slave.c | 6 ++++++
> > 4 files changed, 27 insertions(+)
> >
> > diff --git a/include/net/dsa.h b/include/net/dsa.h
> > index 7f2a668ef2cc..2c2c10812814 100644
> > --- a/include/net/dsa.h
> > +++ b/include/net/dsa.h
> > @@ -400,6 +400,8 @@ struct dsa_switch_ops {
> > void (*port_stp_state_set)(struct dsa_switch *ds, int port,
> > u8 state);
> > void (*port_fast_age)(struct dsa_switch *ds, int port);
> > + int (*port_egress_floods)(struct dsa_switch *ds, int port,
> > + bool unicast, bool multicast);
> >
> > /*
> > * VLAN support
> > diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
> > index 1f4972dab9f2..f4f99ec29f5d 100644
> > --- a/net/dsa/dsa_priv.h
> > +++ b/net/dsa/dsa_priv.h
> > @@ -160,6 +160,8 @@ int dsa_port_mdb_add(const struct dsa_port *dp,
> > struct switchdev_trans *trans);
> > int dsa_port_mdb_del(const struct dsa_port *dp,
> > const struct switchdev_obj_port_mdb *mdb);
> > +int dsa_port_bridge_flags(const struct dsa_port *dp, unsigned long flags,
> > + struct switchdev_trans *trans);
> > int dsa_port_vlan_add(struct dsa_port *dp,
> > const struct switchdev_obj_port_vlan *vlan,
> > struct switchdev_trans *trans);
> > diff --git a/net/dsa/port.c b/net/dsa/port.c
> > index 2d7e01b23572..6df29bddf37e 100644
> > --- a/net/dsa/port.c
> > +++ b/net/dsa/port.c
> > @@ -177,6 +177,23 @@ int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock,
> > return dsa_port_notify(dp, DSA_NOTIFIER_AGEING_TIME, &info);
> > }
> >
> > +int dsa_port_bridge_flags(const struct dsa_port *dp, unsigned long flags,
> > + struct switchdev_trans *trans)
> > +{
> > + struct dsa_switch *ds = dp->ds;
> > + int port = dp->index;
> > + int err = 0;
> > +
> > + if (switchdev_trans_ph_prepare(trans))
> > + return 0;
> > +
> > + if (ds->ops->port_egress_floods)
> > + err = ds->ops->port_egress_floods(ds, port, flags & BR_FLOOD,
> > + flags & BR_MCAST_FLOOD);
> > +
> > + return err;
> > +}
> > +
> > int dsa_port_fdb_add(struct dsa_port *dp, const unsigned char *addr,
> > u16 vid)
> > {
> > diff --git a/net/dsa/slave.c b/net/dsa/slave.c
> > index 2e5e7c04821b..f99161c3b1ea 100644
> > --- a/net/dsa/slave.c
> > +++ b/net/dsa/slave.c
> > @@ -295,6 +295,9 @@ static int dsa_slave_port_attr_set(struct net_device *dev,
> > case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME:
> > ret = dsa_port_ageing_time(dp, attr->u.ageing_time, trans);
> > break;
> > + case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
> > + ret = dsa_port_bridge_flags(dp, attr->u.brport_flags, trans);
> > + break;
> > default:
> > ret = -EOPNOTSUPP;
> > break;
> > @@ -384,6 +387,9 @@ static int dsa_slave_port_attr_get(struct net_device *dev,
> > switch (attr->id) {
> > case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT:
> > attr->u.brport_flags_support = 0;
> > + if (ds->ops->port_egress_floods)
> > + attr->u.brport_flags_support |= BR_FLOOD |
> > + BR_MCAST_FLOOD;
>
> There is no struct dsa_switch *ds = dp->ds that is being declared in
> dsa_slave_port_attr_get():
>
> net/dsa/slave.c: In function 'dsa_slave_port_attr_get':
> net/dsa/slave.c:390:7: error: 'ds' undeclared (first use in this function)
> if (ds->ops->port_egress_floods)
> ^~
> net/dsa/slave.c:390:7: note: each undeclared identifier is reported only
> once for each function it appears in
> scripts/Makefile.build:276: recipe for target 'net/dsa/slave.o' failed
> make[4]: *** [net/dsa/slave.o] Error 1
> scripts/Makefile.build:492: recipe for target 'net/dsa' failed
> make[3]: *** [net/dsa] Error 2
> make[3]: *** Waiting for unfinished jobs....
>
> --
> Florian
>
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up
^ permalink raw reply
* [PATCH] sysctl: Fix proc_do_large_bitmap for large input buffers
From: Eric Sandeen @ 2019-02-20 23:32 UTC (permalink / raw)
To: Linux Kernel Mailing List, fsdevel, netdev; +Cc: Luis Chamberlain, Kees Cook
Today, proc_do_large_bitmap() truncates a large write input buffer
to PAGE_SIZE - 1, which may result in misparsed numbers at the
(truncated) end of the buffer. Further, it fails to notify the caller
that the buffer was truncated, so it doesn't get called iteratively
to finish the entire input buffer.
Tell the caller if there's more work to do by adding the skipped
amount back to left/*lenp before returning.
To fix the misparsing, reset the position if we have completely
consumed a truncated buffer (or if just one char is left, which
may be a "-" in a range), and ask the caller to come back for
more.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index ba4d9e85feb8..970a96659809 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -3089,9 +3089,13 @@ int proc_do_large_bitmap(struct ctl_table *table, int write,
if (write) {
char *kbuf, *p;
+ size_t skipped = 0;
- if (left > PAGE_SIZE - 1)
+ if (left > PAGE_SIZE - 1) {
left = PAGE_SIZE - 1;
+ /* How much of the buffer we'll skip this pass */
+ skipped = *lenp - left;
+ }
p = kbuf = memdup_user_nul(buffer, left);
if (IS_ERR(kbuf))
@@ -3108,9 +3112,22 @@ int proc_do_large_bitmap(struct ctl_table *table, int write,
while (!err && left) {
unsigned long val_a, val_b;
bool neg;
+ size_t saved_left;
+ /* In case we stop parsing mid-number, we can reset */
+ saved_left = left;
err = proc_get_long(&p, &left, &val_a, &neg, tr_a,
sizeof(tr_a), &c);
+ /*
+ * If we consumed the entirety of a truncated buffer or
+ * only one char is left (may be a "-"), then stop here,
+ * reset, & come back for more.
+ */
+ if ((left <= 1) && skipped) {
+ left = saved_left;
+ break;
+ }
+
if (err)
break;
if (val_a >= bitmap_len || neg) {
@@ -3128,6 +3145,15 @@ int proc_do_large_bitmap(struct ctl_table *table, int write,
err = proc_get_long(&p, &left, &val_b,
&neg, tr_b, sizeof(tr_b),
&c);
+ /*
+ * If we consumed all of a truncated buffer or
+ * then stop here, reset, & come back for more.
+ */
+ if (!left && skipped) {
+ left = saved_left;
+ break;
+ }
+
if (err)
break;
if (val_b >= bitmap_len || neg ||
@@ -3146,6 +3172,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write,
proc_skip_char(&p, &left, '\n');
}
kfree(kbuf);
+ left += skipped;
} else {
unsigned long bit_a, bit_b = 0;
^ permalink raw reply related
* Re: [PATCH] sysctl: Fix proc_do_large_bitmap for large input buffers
From: Eric Sandeen @ 2019-02-20 23:35 UTC (permalink / raw)
To: Eric Sandeen, Linux Kernel Mailing List, fsdevel, netdev
Cc: Luis Chamberlain, Kees Cook
In-Reply-To: <53be40fc-6ec4-c714-a64e-f69c96f7058f@redhat.com>
Here's a pretty hacky test script to test this code via
ip_local_reserved_ports
-----
#!/bin/bash
# Randomly construct well-formed (sequential, non-overlapping)
# input for ip_local_reserved_ports, feed it to the sysctl,
# then read it back and check for differences.
# Port range to use
PORT_START=1024
PORT_STOP=32768
# Total length of ports string to use
LENGTH=$((4096+$((RANDOM % 16384))))
# String containing our list of ports
PORTS=$PORT_START
# Try 1000 times
for I in `seq 1 1000`; do
# build up the string
while true; do
# Make sure it's discontiguous, skip ahead at least 2
SKIP=$((2 + RANDOM % 10))
PORT_START=$((PORT_START + SKIP))
if [ "$PORT_START" -ge "$PORT_STOP" ]; then
break;
fi
# 14856-14863,14861
# Add a range, or a single port
USERANGE=$((RANDOM % 2))
if [ "$USERANGE" -eq "1" ]; then
RANGE_START=$PORT_START
RANGE_LEN=$((1 + RANDOM % 10))
RANGE_END=$((RANGE_START + RANGE_LEN))
PORTS="${PORTS},${RANGE_START}-${RANGE_END}"
# Break out if we've done enough
if [ "$RANGE_END" -eq "$PORT_STOP" ]; then
break;
fi
PORT_START=$RANGE_END
else
PORTS="${PORTS},${PORT_START}"
fi
if [ "${#PORTS}" -gt "$LENGTH" ]; then
break;
fi
done
# See if we get out what we put in
echo "Trial $I"
echo $PORTS > port_list
cat port_list > /proc/sys/net/ipv4/ip_local_reserved_ports || break
cat /proc/sys/net/ipv4/ip_local_reserved_ports > port_list_out
diff -uq port_list port_list_out || break
done
^ permalink raw reply
* [PATCH net-next v5 0/3] net: dsa: mv88e6xxx: fix IPv6
From: Florian Fainelli @ 2019-02-20 23:35 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, andrew, vivien.didelot, davem, rmk+kernel,
hkallweit1
We have had some emails in private over this issue, this is my current
patch set rebased on top of net-next which provides working IPv6 (and
probably other protocols as well) over mv88e6xxx DSA switches.
The problem comes down to mv88e6xxx defaulting to not flood unknown
unicast and multicast datagrams, as they would be by dumb switches,
and as the Linux bridge code does by default.
There is also the issue of IPv6 over a vlan that is transparent to the
bridge; the multicast querier will not reach inside the vlan, and so
the switch can not learn about multicast routing within the vlan.
These flood settings can be disabled via the Linux bridge code if it's
desired to make the switch behave more like a managed switch, eg, by
enabling the multicast querier. However, the multicast querier
defaults to being disabled which effectively means that by default,
mv88e6xxx switches block all multicast traffic. This is at odds with
the Linux bridge documentation, and the defaults that the Linux bridge
code adopts.
So, this patch set adds DSA support for Linux bridge flags, adds
mv88e6xxx support for the unicast and multicast flooding flags, and
lastly enables flooding of these frames by default to match the
Linux bridge defaults.
Russell King (3):
net: dsa: add support for bridge flags
net: dsa: mv88e6xxx: add support for bridge flags
net: dsa: enable flooding for bridge ports
drivers/net/dsa/mv88e6xxx/chip.c | 17 ++++++++++++++++
include/net/dsa.h | 2 ++
net/dsa/dsa_priv.h | 2 ++
net/dsa/port.c | 33 +++++++++++++++++++++++++++++---
net/dsa/slave.c | 9 +++++++++
5 files changed, 60 insertions(+), 3 deletions(-)
v2: fix a couple of compile errors in patch 2 and patch 3 (oops).
v3: change interface between core DSA and drivers
v4: fix comments from v3
v5: fix build failure in patch #1
--
2.17.1
^ permalink raw reply
* [PATCH net-next v5 1/3] net: dsa: add support for bridge flags
From: Florian Fainelli @ 2019-02-20 23:35 UTC (permalink / raw)
To: netdev
Cc: Russell King, Florian Fainelli, andrew, vivien.didelot, davem,
hkallweit1
In-Reply-To: <20190220233506.22210-1-f.fainelli@gmail.com>
From: Russell King <rmk+kernel@armlinux.org.uk>
The Linux bridge implementation allows various properties of the bridge
to be controlled, such as flooding unknown unicast and multicast frames.
This patch adds the necessary DSA infrastructure to allow the Linux
bridge support to control these properties for DSA switches.
Reviewed-by: Vivien Didelot <vivien.didelot@gmail.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
[florian: Add missing dp and ds variables declaration to fix build]
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
include/net/dsa.h | 2 ++
net/dsa/dsa_priv.h | 2 ++
net/dsa/port.c | 17 +++++++++++++++++
net/dsa/slave.c | 9 +++++++++
4 files changed, 30 insertions(+)
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 7f2a668ef2cc..2c2c10812814 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -400,6 +400,8 @@ struct dsa_switch_ops {
void (*port_stp_state_set)(struct dsa_switch *ds, int port,
u8 state);
void (*port_fast_age)(struct dsa_switch *ds, int port);
+ int (*port_egress_floods)(struct dsa_switch *ds, int port,
+ bool unicast, bool multicast);
/*
* VLAN support
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index 1f4972dab9f2..f4f99ec29f5d 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -160,6 +160,8 @@ int dsa_port_mdb_add(const struct dsa_port *dp,
struct switchdev_trans *trans);
int dsa_port_mdb_del(const struct dsa_port *dp,
const struct switchdev_obj_port_mdb *mdb);
+int dsa_port_bridge_flags(const struct dsa_port *dp, unsigned long flags,
+ struct switchdev_trans *trans);
int dsa_port_vlan_add(struct dsa_port *dp,
const struct switchdev_obj_port_vlan *vlan,
struct switchdev_trans *trans);
diff --git a/net/dsa/port.c b/net/dsa/port.c
index 2d7e01b23572..6df29bddf37e 100644
--- a/net/dsa/port.c
+++ b/net/dsa/port.c
@@ -177,6 +177,23 @@ int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock,
return dsa_port_notify(dp, DSA_NOTIFIER_AGEING_TIME, &info);
}
+int dsa_port_bridge_flags(const struct dsa_port *dp, unsigned long flags,
+ struct switchdev_trans *trans)
+{
+ struct dsa_switch *ds = dp->ds;
+ int port = dp->index;
+ int err = 0;
+
+ if (switchdev_trans_ph_prepare(trans))
+ return 0;
+
+ if (ds->ops->port_egress_floods)
+ err = ds->ops->port_egress_floods(ds, port, flags & BR_FLOOD,
+ flags & BR_MCAST_FLOOD);
+
+ return err;
+}
+
int dsa_port_fdb_add(struct dsa_port *dp, const unsigned char *addr,
u16 vid)
{
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 2e5e7c04821b..85dc68611002 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -295,6 +295,9 @@ static int dsa_slave_port_attr_set(struct net_device *dev,
case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME:
ret = dsa_port_ageing_time(dp, attr->u.ageing_time, trans);
break;
+ case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
+ ret = dsa_port_bridge_flags(dp, attr->u.brport_flags, trans);
+ break;
default:
ret = -EOPNOTSUPP;
break;
@@ -381,9 +384,15 @@ static int dsa_slave_get_port_parent_id(struct net_device *dev,
static int dsa_slave_port_attr_get(struct net_device *dev,
struct switchdev_attr *attr)
{
+ struct dsa_port *dp = dsa_slave_to_port(dev);
+ struct dsa_switch *ds = dp->ds;
+
switch (attr->id) {
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT:
attr->u.brport_flags_support = 0;
+ if (ds->ops->port_egress_floods)
+ attr->u.brport_flags_support |= BR_FLOOD |
+ BR_MCAST_FLOOD;
break;
default:
return -EOPNOTSUPP;
--
2.17.1
^ permalink raw reply related
* [PATCH net-next v5 2/3] net: dsa: mv88e6xxx: add support for bridge flags
From: Florian Fainelli @ 2019-02-20 23:35 UTC (permalink / raw)
To: netdev; +Cc: Russell King, andrew, vivien.didelot, davem, hkallweit1
In-Reply-To: <20190220233506.22210-1-f.fainelli@gmail.com>
From: Russell King <rmk+kernel@armlinux.org.uk>
Add support for the bridge flags to Marvell 88e6xxx bridges, allowing
the multicast and unicast flood properties to be controlled. These
can be controlled on a per-port basis via commands such as:
bridge link set dev lan1 flood on|off
bridge link set dev lan1 mcast_flood on|off
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Vivien Didelot <vivien.didelot@gmail.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
drivers/net/dsa/mv88e6xxx/chip.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 32e7af5caa69..cc7ce06b6d58 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -4692,6 +4692,22 @@ static int mv88e6xxx_port_mdb_del(struct dsa_switch *ds, int port,
return err;
}
+static int mv88e6xxx_port_egress_floods(struct dsa_switch *ds, int port,
+ bool unicast, bool multicast)
+{
+ struct mv88e6xxx_chip *chip = ds->priv;
+ int err = -EOPNOTSUPP;
+
+ mutex_lock(&chip->reg_lock);
+ if (chip->info->ops->port_set_egress_floods)
+ err = chip->info->ops->port_set_egress_floods(chip, port,
+ unicast,
+ multicast);
+ mutex_unlock(&chip->reg_lock);
+
+ return err;
+}
+
static const struct dsa_switch_ops mv88e6xxx_switch_ops = {
#if IS_ENABLED(CONFIG_NET_DSA_LEGACY)
.probe = mv88e6xxx_drv_probe,
@@ -4719,6 +4735,7 @@ static const struct dsa_switch_ops mv88e6xxx_switch_ops = {
.set_ageing_time = mv88e6xxx_set_ageing_time,
.port_bridge_join = mv88e6xxx_port_bridge_join,
.port_bridge_leave = mv88e6xxx_port_bridge_leave,
+ .port_egress_floods = mv88e6xxx_port_egress_floods,
.port_stp_state_set = mv88e6xxx_port_stp_state_set,
.port_fast_age = mv88e6xxx_port_fast_age,
.port_vlan_filtering = mv88e6xxx_port_vlan_filtering,
--
2.17.1
^ permalink raw reply related
* [PATCH net-next v5 3/3] net: dsa: enable flooding for bridge ports
From: Florian Fainelli @ 2019-02-20 23:35 UTC (permalink / raw)
To: netdev; +Cc: Russell King, andrew, vivien.didelot, davem, hkallweit1
In-Reply-To: <20190220233506.22210-1-f.fainelli@gmail.com>
From: Russell King <rmk+kernel@armlinux.org.uk>
Switches work by learning the MAC address for each attached station by
monitoring traffic from each station. When a station sends a packet,
the switch records which port the MAC address is connected to.
With IPv4 networking, before communication commences with a neighbour,
an ARP packet is broadcasted to all stations asking for the MAC address
corresponding with the IPv4. The desired station responds with an ARP
reply, and the ARP reply causes the switch to learn which port the
station is connected to.
With IPv6 networking, the situation is rather different. Rather than
broadcasting ARP packets, a "neighbour solicitation" is multicasted
rather than broadcasted. This multicast needs to reach the intended
station in order for the neighbour to be discovered.
Once a neighbour has been discovered, and entered into the sending
stations neighbour cache, communication can restart at a point later
without sending a new neighbour solicitation, even if the entry in
the neighbour cache is marked as stale. This can be after the MAC
address has expired from the forwarding cache of the DSA switch -
when that occurs, there is a long pause in communication.
Our DSA implementation for mv88e6xxx switches disables flooding of
multicast and unicast frames for bridged ports. As per the above
description, this is fine for IPv4 networking, since the broadcasted
ARP queries will be sent to and received by all stations on the same
network. However, this breaks IPv6 very badly - blocking neighbour
solicitations and later causing connections to stall.
The defaults that the Linux bridge code expect from bridges are for
unknown unicast and unknown multicast frames to be flooded to all ports
on the bridge, which is at odds to the defaults adopted by our DSA
implementation for mv88e6xxx switches.
This commit enables by default flooding of both unknown unicast and
unknown multicast frames whenever a port is added to a bridge, and
disables the flooding when a port leaves the bridge. This means that
mv88e6xxx DSA switches now behave as per the bridge(8) man page, and
IPv6 works flawlessly through such a switch.
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Vivien Didelot <vivien.didelot@gmail.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
net/dsa/port.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/net/dsa/port.c b/net/dsa/port.c
index 6df29bddf37e..7bc2a5ad95c6 100644
--- a/net/dsa/port.c
+++ b/net/dsa/port.c
@@ -105,16 +105,23 @@ int dsa_port_bridge_join(struct dsa_port *dp, struct net_device *br)
};
int err;
- /* Here the port is already bridged. Reflect the current configuration
- * so that drivers can program their chips accordingly.
+ /* Set the flooding mode before joining the port in the switch */
+ err = dsa_port_bridge_flags(dp, BR_FLOOD | BR_MCAST_FLOOD, NULL);
+ if (err)
+ return err;
+
+ /* Here the interface is already bridged. Reflect the current
+ * configuration so that drivers can program their chips accordingly.
*/
dp->bridge_dev = br;
err = dsa_port_notify(dp, DSA_NOTIFIER_BRIDGE_JOIN, &info);
/* The bridging is rolled back on error */
- if (err)
+ if (err) {
+ dsa_port_bridge_flags(dp, 0, NULL);
dp->bridge_dev = NULL;
+ }
return err;
}
@@ -137,6 +144,9 @@ void dsa_port_bridge_leave(struct dsa_port *dp, struct net_device *br)
if (err)
pr_err("DSA: failed to notify DSA_NOTIFIER_BRIDGE_LEAVE\n");
+ /* Port is leaving the bridge, disable flooding */
+ dsa_port_bridge_flags(dp, 0, NULL);
+
/* Port left the bridge, put in BR_STATE_DISABLED by the bridge layer,
* so allow it to be in BR_STATE_FORWARDING to be kept functional
*/
--
2.17.1
^ permalink raw reply related
* Re: [PATCH v1 net-next 2/4] net: dsa: microchip: add MIB counter reading support
From: Joe Perches @ 2019-02-20 23:49 UTC (permalink / raw)
To: Florian Fainelli, Tristram.Ha, andrew
Cc: sergio.paracuellos, pavel, UNGLinuxDriver, netdev
In-Reply-To: <BC575D76-0419-4318-B924-81E29858B8E9@gmail.com>
On Tue, 2019-02-12 at 19:51 -0800, Florian Fainelli wrote:
> On February 12, 2019 6:39:49 PM PST, Tristram.Ha@microchip.com wrote:
> > > > +static void ksz9477_freeze_mib(struct ksz_device *dev, int port,
> > > > + bool freeze)
> > > > +{
> > > > + struct ksz_port *p = &dev->ports[port];
> > > > + u32 val = freeze ? MIB_COUNTER_FLUSH_FREEZE : 0;
> > >
> > > Reverse Christmas tree.
> >
> > There was a checkpatch.pl patch in 2016 that tried to check this, but
> > it was never accepted?
https://lore.kernel.org/patchwork/patch/732076/
While I still think use of reverse christmas tree is misguided,
there were some disagreements about what form it really is:
Is this reverse christmas tree?
void foo(void)
{
int aa;
int a = 1;
or is
void foo(void)
{
int a = 1;
int aa;
IMHO: neither really helps to visually find or scan for
automatics so the whole concept isn't particularly useful.
^ permalink raw reply
* Re: mlx5 stable backport help
From: Saeed Mahameed @ 2019-02-20 23:58 UTC (permalink / raw)
To: davem@davemloft.net; +Cc: netdev@vger.kernel.org, Or Gerlitz
In-Reply-To: <20190220.122740.445688569983151429.davem@davemloft.net>
On Wed, 2019-02-20 at 12:27 -0800, David Miller wrote:
> From: Saeed Mahameed <saeedm@mellanox.com>
> Date: Wed, 20 Feb 2019 20:01:00 +0000
>
> > On Tue, 2019-02-19 at 22:36 -0800, David Miller wrote:
> > > 218d05ce326f9e1b40a56085431fa1068b43d5d9 ("net/mlx5e: Don't
> > > overwrite
> > > pedit action when multiple pedit used")
> > >
> >
> > I tried and this patch applies smoothly on 4.19.
>
> Does not apply to v4.19.24 which is the current stable release.
>
> [davem@localhost linux-stable]$ git am QUEUE/mlx5e/0002-net-mlx5e-
> Don-t-overwrite-pedit-action-when-multiple.patch
> Applying: net/mlx5e: Don't overwrite pedit action when multiple pedit
> used
> error: patch failed:
> drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:128
> error: drivers/net/ethernet/mellanox/mlx5/core/en_tc.c: patch does
> not apply
> Patch failed at 0001 net/mlx5e: Don't overwrite pedit action when
> multiple pedit used
> hint: Use 'git am --show-current-patch' to see the failed patch
> When you have resolved this problem, run "git am --continue".
> If you prefer to skip this patch, run "git am --skip" instead.
> To restore the original branch and stop patching, run "git am --
> abort".
Strange, worked for me: (I saw some warnings though!)
saeedm@sx1[linux](stbl/4.19)$ git cherry-pick
218d05ce326f9e1b40a56085431fa1068b43d5d9
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your merge.renamelimit variable to at
least 2119 and retry the command.
[stbl/4.19 efa42113bb1d] net/mlx5e: Don't overwrite pedit action when
multiple pedit used
Author: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Date: Mon Jan 28 15:28:06 2019 -0800
1 file changed, 15 insertions(+), 10 deletions(-)
saeedm@sx1[linux](stbl/4.19)$ git log --oneline
efa42113bb1d (HEAD -> stbl/4.19) net/mlx5e: Don't overwrite pedit
action when multiple pedit used
f287634fe321 (tag: v4.19.24, stable/linux-4.19.y) Linux 4.19.24
dd5f4d067a2c mm: proc: smaps_rollup: fix pss_locked calculation
I did what the git suggested and:
$ git config merge.renamelimit 2119
Tried again, it worked with now warnings.
Maybe you have some git config which fails on the warning i saw..
Thanks,
Saeed.
^ permalink raw reply
* Re: [PATCH bpf-next v2] bpf, seccomp: fix false positive preemption splat for cbpf->ebpf progs
From: Alexei Starovoitov @ 2019-02-20 23:59 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: ast, keescook, netdev
In-Reply-To: <20190220230135.9748-1-daniel@iogearbox.net>
On Thu, Feb 21, 2019 at 12:01:35AM +0100, Daniel Borkmann wrote:
> In 568f196756ad ("bpf: check that BPF programs run with preemption disabled")
> a check was added for BPF_PROG_RUN() that for every invocation preemption is
> disabled to not break eBPF assumptions (e.g. per-cpu map). Of course this does
> not count for seccomp because only cBPF -> eBPF is loaded here and it does
> not make use of any functionality that would require this assertion. Fix this
> false positive by adding and using SECCOMP_RUN() variant that does not have
> the cant_sleep(); check.
>
> Fixes: 568f196756ad ("bpf: check that BPF programs run with preemption disabled")
> Reported-by: syzbot+8bf19ee2aa580de7a2a7@syzkaller.appspotmail.com
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> Acked-by: Kees Cook <keescook@chromium.org>
Applied, Thanks
^ permalink raw reply
* [PATCH net 0/2] bnxt_en: firmware message delay fixes.
From: Michael Chan @ 2019-02-21 0:07 UTC (permalink / raw)
To: davem; +Cc: netdev
We were seeing some intermittent firmware message timeouts in our lab and
these 2 small patches fix them. Please apply to stable as well. Thanks.
Michael Chan (2):
bnxt_en: Fix typo in firmware message timeout logic.
bnxt_en: Wait longer for the firmware message response to complete.
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 ++--
drivers/net/ethernet/broadcom/bnxt/bnxt.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
--
2.5.1
^ permalink raw reply
* [PATCH net 1/2] bnxt_en: Fix typo in firmware message timeout logic.
From: Michael Chan @ 2019-02-21 0:07 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <1550707652-14747-1-git-send-email-michael.chan@broadcom.com>
The logic that polls for the firmware message response uses a shorter
sleep interval for the first few passes. But there was a typo so it
was using the wrong counter (larger counter) for these short sleep
passes. The result is a slightly shorter timeout period for these
firmware messages than intended. Fix it by using the proper counter.
Fixes: 9751e8e71487 ("bnxt_en: reduce timeout on initial HWRM calls")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 8bc7e49..1ddd672 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -3903,7 +3903,7 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
if (len)
break;
/* on first few passes, just barely sleep */
- if (i < DFLT_HWRM_CMD_TIMEOUT)
+ if (i < HWRM_SHORT_TIMEOUT_COUNTER)
usleep_range(HWRM_SHORT_MIN_TIMEOUT,
HWRM_SHORT_MAX_TIMEOUT);
else
--
2.5.1
^ permalink raw reply related
* [PATCH net 2/2] bnxt_en: Wait longer for the firmware message response to complete.
From: Michael Chan @ 2019-02-21 0:07 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <1550707652-14747-1-git-send-email-michael.chan@broadcom.com>
The code waits up to 20 usec for the firmware response to complete
once we've seen the valid response header in the buffer. It turns
out that in some scenarios, this wait time is not long enough.
Extend it to 150 usec and use usleep_range() instead of udelay().
Fixes: 9751e8e71487 ("bnxt_en: reduce timeout on initial HWRM calls")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +-
drivers/net/ethernet/broadcom/bnxt/bnxt.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 1ddd672..d95730c 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -3926,7 +3926,7 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
dma_rmb();
if (*valid)
break;
- udelay(1);
+ usleep_range(1, 5);
}
if (j >= HWRM_VALID_BIT_DELAY_USEC) {
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
index a451796..2fb653e 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
@@ -582,7 +582,7 @@ struct nqe_cn {
(HWRM_SHORT_TIMEOUT_COUNTER * HWRM_SHORT_MIN_TIMEOUT + \
((n) - HWRM_SHORT_TIMEOUT_COUNTER) * HWRM_MIN_TIMEOUT))
-#define HWRM_VALID_BIT_DELAY_USEC 20
+#define HWRM_VALID_BIT_DELAY_USEC 150
#define BNXT_HWRM_CHNL_CHIMP 0
#define BNXT_HWRM_CHNL_KONG 1
--
2.5.1
^ permalink raw reply related
* Re: [PATCH net] net: ip6_gre: fix possible NULL pointer dereference in ip6erspan_set_version
From: Gregory Rose @ 2019-02-21 0:12 UTC (permalink / raw)
To: Lorenzo Bianconi, davem; +Cc: netdev, syzbot+30191cf1057abd3064af
In-Reply-To: <367cdc7c2c859abccfe67eee36cd97f9bf0b2544.1550620650.git.lorenzo.bianconi@redhat.com>
On 2/20/2019 12:23 AM, Lorenzo Bianconi wrote:
> Fix a possible NULL pointer dereference in ip6erspan_set_version checking
> nlattr data pointer
>
> kasan: CONFIG_KASAN_INLINE enabled
> kasan: GPF could be caused by NULL-ptr deref or user memory access
> general protection fault: 0000 [#1] PREEMPT SMP KASAN
> CPU: 1 PID: 7549 Comm: syz-executor432 Not tainted 5.0.0-rc6-next-20190218
> #37
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> RIP: 0010:ip6erspan_set_version+0x5c/0x350 net/ipv6/ip6_gre.c:1726
> Code: 07 38 d0 7f 08 84 c0 0f 85 9f 02 00 00 49 8d bc 24 b0 00 00 00 c6 43
> 54 01 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f
> 85 9a 02 00 00 4d 8b ac 24 b0 00 00 00 4d 85 ed 0f
> RSP: 0018:ffff888089ed7168 EFLAGS: 00010202
> RAX: dffffc0000000000 RBX: ffff8880869d6e58 RCX: 0000000000000000
> RDX: 0000000000000016 RSI: ffffffff862736b4 RDI: 00000000000000b0
> RBP: ffff888089ed7180 R08: 1ffff11010d3adcb R09: ffff8880869d6e58
> R10: ffffed1010d3add5 R11: ffff8880869d6eaf R12: 0000000000000000
> R13: ffffffff8931f8c0 R14: ffffffff862825d0 R15: ffff8880869d6e58
> FS: 0000000000b3d880(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 0000000020000184 CR3: 0000000092cc5000 CR4: 00000000001406e0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> Call Trace:
> ip6erspan_newlink+0x66/0x7b0 net/ipv6/ip6_gre.c:2210
> __rtnl_newlink+0x107b/0x16c0 net/core/rtnetlink.c:3176
> rtnl_newlink+0x69/0xa0 net/core/rtnetlink.c:3234
> rtnetlink_rcv_msg+0x465/0xb00 net/core/rtnetlink.c:5192
> netlink_rcv_skb+0x17a/0x460 net/netlink/af_netlink.c:2485
> rtnetlink_rcv+0x1d/0x30 net/core/rtnetlink.c:5210
> netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline]
> netlink_unicast+0x536/0x720 net/netlink/af_netlink.c:1336
> netlink_sendmsg+0x8ae/0xd70 net/netlink/af_netlink.c:1925
> sock_sendmsg_nosec net/socket.c:621 [inline]
> sock_sendmsg+0xdd/0x130 net/socket.c:631
> ___sys_sendmsg+0x806/0x930 net/socket.c:2136
> __sys_sendmsg+0x105/0x1d0 net/socket.c:2174
> __do_sys_sendmsg net/socket.c:2183 [inline]
> __se_sys_sendmsg net/socket.c:2181 [inline]
> __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2181
> do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
> entry_SYSCALL_64_after_hwframe+0x49/0xbe
> RIP: 0033:0x440159
> Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 48 89 f8 48 89 f7
> 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff
> ff 0f 83 fb 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00
> RSP: 002b:00007fffa69156e8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
> RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 0000000000440159
> RDX: 0000000000000000 RSI: 0000000020001340 RDI: 0000000000000003
> RBP: 00000000006ca018 R08: 0000000000000001 R09: 00000000004002c8
> R10: 0000000000000011 R11: 0000000000000246 R12: 00000000004019e0
> R13: 0000000000401a70 R14: 0000000000000000 R15: 0000000000000000
> Modules linked in:
> ---[ end trace 09f8a7d13b4faaa1 ]---
> RIP: 0010:ip6erspan_set_version+0x5c/0x350 net/ipv6/ip6_gre.c:1726
> Code: 07 38 d0 7f 08 84 c0 0f 85 9f 02 00 00 49 8d bc 24 b0 00 00 00 c6 43
> 54 01 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f
> 85 9a 02 00 00 4d 8b ac 24 b0 00 00 00 4d 85 ed 0f
> RSP: 0018:ffff888089ed7168 EFLAGS: 00010202
> RAX: dffffc0000000000 RBX: ffff8880869d6e58 RCX: 0000000000000000
> RDX: 0000000000000016 RSI: ffffffff862736b4 RDI: 00000000000000b0
> RBP: ffff888089ed7180 R08: 1ffff11010d3adcb R09: ffff8880869d6e58
> R10: ffffed1010d3add5 R11: ffff8880869d6eaf R12: 0000000000000000
> R13: ffffffff8931f8c0 R14: ffffffff862825d0 R15: ffff8880869d6e58
> FS: 0000000000b3d880(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 0000000020000184 CR3: 0000000092cc5000 CR4: 00000000001406e0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
>
>
> Fixes: 4974d5f678ab ("net: ip6_gre: initialize erspan_ver just for erspan tunnels")
> Reported-and-tested-by: syzbot+30191cf1057abd3064af@syzkaller.appspotmail.com
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
> ---
> net/ipv6/ip6_gre.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
> index 43890898b0b5..4b9dd5e88329 100644
> --- a/net/ipv6/ip6_gre.c
> +++ b/net/ipv6/ip6_gre.c
> @@ -1722,6 +1722,9 @@ static int ip6erspan_tap_validate(struct nlattr *tb[], struct nlattr *data[],
> static void ip6erspan_set_version(struct nlattr *data[],
> struct __ip6_tnl_parm *parms)
> {
> + if (!data)
> + return;
> +
> parms->erspan_ver = 1;
> if (data[IFLA_GRE_ERSPAN_VER])
> parms->erspan_ver = nla_get_u8(data[IFLA_GRE_ERSPAN_VER]);
Oh right. Yes, that's needed.
Thanks!
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
^ permalink raw reply
* Re: [PATCH 6/6] net: ethernet: ti: cpsw: deprecate cpsw-phy-sel driver
From: David Miller @ 2019-02-21 0:18 UTC (permalink / raw)
To: tony
Cc: grygorii.strashko, kishon, robh+dt, netdev, nsekhar, linux-kernel,
linux-omap, devicetree, linux-arm-kernel
In-Reply-To: <20190220210127.GU15711@atomide.com>
From: Tony Lindgren <tony@atomide.com>
Date: Wed, 20 Feb 2019 13:01:27 -0800
> What I can do is set up a separate branch with just this
> patch on top of the dts changes that the arm-soc guys can
> then merge towards the end of the merge cycle. If that
> works for you, let me know and I'll do it.
Yes, it does work for me.
Thanks.
^ permalink raw reply
* Re: mlx5 stable backport help
From: David Miller @ 2019-02-21 0:21 UTC (permalink / raw)
To: saeedm; +Cc: netdev, ogerlitz
In-Reply-To: <3a7ae12b86320a37ca2da07a7d3af092bb3104f6.camel@mellanox.com>
From: Saeed Mahameed <saeedm@mellanox.com>
Date: Wed, 20 Feb 2019 23:58:12 +0000
> Maybe you have some git config which fails on the warning i saw..
Put the actual commit into a patch using "git format-patch" then try
to use "git am" to apply it.
I'm not doing anything fancy.
^ permalink raw reply
* [PATCH] Set rtm_table to RT_TABLE_COMPAT for ipv6 for tables > 255
From: Kalash Nainwal @ 2019-02-21 0:23 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-kernel, kalash
Set rtm_table to RT_TABLE_COMPAT for ipv6 for tables > 255 to
keep legacy software happy. This is similar to what was done for
ipv4 in commit 709772e6e065 ("net: Fix routing tables with
id > 255 for legacy software").
Signed-off-by: Kalash Nainwal <kalash@arista.com>
---
net/ipv6/route.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 964491cf3672..77c07b2943f5 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -4649,7 +4649,7 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
table = rt->fib6_table->tb6_id;
else
table = RT6_TABLE_UNSPEC;
- rtm->rtm_table = table;
+ rtm->rtm_table = table < 256 ? table : RT_TABLE_COMPAT;
if (nla_put_u32(skb, RTA_TABLE, table))
goto nla_put_failure;
--
2.19.1
^ permalink raw reply related
* Re: [RFC] net: dsa: qca8k: CPU port broken with commit 5502b218e001 ("net: phy: use phy_resolve_aneg_linkmode in genphy_read_status")
From: Andrew Lunn @ 2019-02-21 0:38 UTC (permalink / raw)
To: Michal Vokáč
Cc: Vinod Koul, Heiner Kallweit, David S. Miller, Florian Fainelli,
netdev
In-Reply-To: <d127618b-873e-e4aa-ea75-f747da5574ee@ysoft.com>
On Wed, Feb 20, 2019 at 04:02:32PM +0100, Michal Vokáč wrote:
> Hi,
>
> Another issue in a row with networking on imx6dl-yapp4 platform [1]
> that uses QCA8334 Ethernet switch.
>
> Very recently, with Vinod and Andrew, we solved an issue with
> RGMII_ID mode by patch[2][3]. I tested those with next-20190215
> and it worked just fine.
>
> The patch[2] was merged into next-20190220 so I tested the latest version.
> Now the cpu port does not work again. I tracked it down to this commit
> 5502b218e001 ("net: phy: use phy_resolve_aneg_linkmode in
> genphy_read_status") [4]
>
> If I revert the offending commit, cpu port works fine. I suspect the
> problem is on the qca8k driver side but I am not really sure.
> AFAICT autonegotiation is not available on the QCA833x cpu port (MAC0).
>
> Any ideas what may be the root cause of the problem?
Hi Michal
I would suggest taking a look at dsa_port_fixed_link_register_of().
It might be a bit more state needs initialising before calling
genphy_read_status()?
Andrew
^ permalink raw reply
* Re: mlx5 stable backport help
From: Saeed Mahameed @ 2019-02-21 0:43 UTC (permalink / raw)
To: davem@davemloft.net; +Cc: netdev@vger.kernel.org, Or Gerlitz
In-Reply-To: <20190220.162127.148580465432446977.davem@davemloft.net>
On Wed, 2019-02-20 at 16:21 -0800, David Miller wrote:
> From: Saeed Mahameed <saeedm@mellanox.com>
> Date: Wed, 20 Feb 2019 23:58:12 +0000
>
> > Maybe you have some git config which fails on the warning i saw..
>
> Put the actual commit into a patch using "git format-patch" then try
> to use "git am" to apply it.
>
> I'm not doing anything fancy.
I see, for some reason cherry-pick is happy to resolve the conflict
without human help.
Anyway the conflict is really simple and contextual, 2 hunks will fail
1) adding a new filed "max_mod_hdr_actions" to "struct
mlx5e_tc_flow_parse_attr"
2) at parse_tc_pedit_action() line 1924 :
replace:
- err = alloc_mod_hdr_actions(priv, a, namespace, parse_attr);
- if (err)
- goto out_err;
with:
+ if (!parse_attr->mod_hdr_actions) {
+ err = alloc_mod_hdr_actions(priv, a, namespace,
parse_attr);
+ if (err)
+ goto out_err;
+ }
all in drivers/net/ethernet/mellanox/mlx5/core/en_tc.c file
they fail since the surrounding code is slightly different.
^ permalink raw reply
* [PATCH net-next v3 0/8] net: Get rid of switchdev_port_attr_get()
From: Florian Fainelli @ 2019-02-21 0:58 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, David S. Miller, Ido Schimmel, open list,
open list:STAGING SUBSYSTEM, moderated list:ETHERNET BRIDGE, jiri,
andrew, vivien.didelot
Hi all,
This patch series splits the removal of the switchdev_ops that was
proposed a few times before and first tackles the easy part which is the
removal of the single call to switchdev_port_attr_get() within the
bridge code.
As suggestd by Ido, this patch series adds a
SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS which is used in the same
context as the caller of switchdev_port_attr_set(), so not deferred, and
then the operation is carried out in deferred context with setting a
support bridge port flag.
Follow-up patches will do the switchdev_ops removal after introducing
the proper helpers for the switchdev blocking notifier to work across
stacked devices (unlike the previous submissions).
David this does depend on Russell's "[PATCH net-next v5 0/3] net: dsa:
mv88e6xxx: fix IPv6".
Changes in v3:
- rebased against net-next/master after Russell's IPv6 changes to DSA
- ignore prepare/commit phase for PRE_BRIDGE_FLAGS since we don't
want to trigger the WARN() in net/switchdev/switchdev.c in the commit
phase
Changes in v2:
- differentiate callers not supporting switchdev_port_attr_set() from
the driver not being able to support specific bridge flags
- pass "mask" instead of "flags" for the PRE_BRIDGE_FLAGS check
- skip prepare phase for PRE_BRIDGE_FLAGS
- corrected documentation a bit more
- tested bridge_vlan_aware.sh with veth/VRF
Florian Fainelli (8):
net: switchdev: Add PORT_PRE_BRIDGE_FLAGS
mlxsw: spectrum: Handle PORT_PRE_BRIDGE_FLAGS
staging: fsl-dpaa2: ethsw: Handle PORT_PRE_BRIDGE_FLAGS
net: dsa: Add setter for SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS
rocker: Check Handle PORT_PRE_BRIDGE_FLAGS
net: bridge: Stop calling switchdev_port_attr_get()
net: Remove SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT
net: Get rid of switchdev_port_attr_get()
Documentation/networking/switchdev.txt | 6 +-
.../mellanox/mlxsw/spectrum_switchdev.c | 32 ++++----
drivers/net/ethernet/rocker/rocker_main.c | 74 ++++++++++---------
drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 29 ++++----
include/net/switchdev.h | 13 +---
net/bridge/br_switchdev.c | 11 ++-
net/dsa/dsa_priv.h | 2 +
net/dsa/port.c | 12 +++
net/dsa/slave.c | 25 +------
9 files changed, 98 insertions(+), 106 deletions(-)
--
2.17.1
^ permalink raw reply
* [PATCH net-next v3 2/8] mlxsw: spectrum: Handle PORT_PRE_BRIDGE_FLAGS
From: Florian Fainelli @ 2019-02-21 0:58 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, David S. Miller, Ido Schimmel, open list,
open list:STAGING SUBSYSTEM, moderated list:ETHERNET BRIDGE, jiri,
andrew, vivien.didelot
In-Reply-To: <20190221005826.26317-1-f.fainelli@gmail.com>
In preparation for getting rid of switchdev_port_attr_get(), have mlxsw
check for the bridge flags being set through switchdev_port_attr_set()
when the SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS attribute identifier is
used.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
.../ethernet/mellanox/mlxsw/spectrum_switchdev.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index 1f492b7dbea8..9a8798f74d2b 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -595,6 +595,17 @@ mlxsw_sp_bridge_port_learning_set(struct mlxsw_sp_port *mlxsw_sp_port,
return err;
}
+static int mlxsw_sp_port_attr_br_pre_flags_set(struct mlxsw_sp_port
+ *mlxsw_sp_port,
+ struct switchdev_trans *trans,
+ unsigned long brport_flags)
+{
+ if (brport_flags & ~(BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD))
+ return -EINVAL;
+
+ return 0;
+}
+
static int mlxsw_sp_port_attr_br_flags_set(struct mlxsw_sp_port *mlxsw_sp_port,
struct switchdev_trans *trans,
struct net_device *orig_dev,
@@ -841,6 +852,11 @@ static int mlxsw_sp_port_attr_set(struct net_device *dev,
attr->orig_dev,
attr->u.stp_state);
break;
+ case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS:
+ err = mlxsw_sp_port_attr_br_pre_flags_set(mlxsw_sp_port,
+ trans,
+ attr->u.brport_flags);
+ break;
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
err = mlxsw_sp_port_attr_br_flags_set(mlxsw_sp_port, trans,
attr->orig_dev,
--
2.17.1
^ permalink raw reply related
* [PATCH net-next v3 3/8] staging: fsl-dpaa2: ethsw: Handle PORT_PRE_BRIDGE_FLAGS
From: Florian Fainelli @ 2019-02-21 0:58 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, David S. Miller, Ido Schimmel, open list,
open list:STAGING SUBSYSTEM, moderated list:ETHERNET BRIDGE, jiri,
andrew, vivien.didelot
In-Reply-To: <20190221005826.26317-1-f.fainelli@gmail.com>
In preparation for removing SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT,
handle the SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS attribute and check
that the bridge port flags being configured are supported.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index 1b3943b71254..331625137717 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -666,6 +666,16 @@ static int port_attr_stp_state_set(struct net_device *netdev,
return ethsw_port_set_stp_state(port_priv, state);
}
+static int port_attr_br_flags_pre_set(struct net_device *netdev,
+ struct switchdev_trans *trans,
+ unsigned long flags)
+{
+ if (flags & ~(BR_LEARNING | BR_FLOOD))
+ return -EINVAL;
+
+ return 0;
+}
+
static int port_attr_br_flags_set(struct net_device *netdev,
struct switchdev_trans *trans,
unsigned long flags)
@@ -698,6 +708,10 @@ static int swdev_port_attr_set(struct net_device *netdev,
err = port_attr_stp_state_set(netdev, trans,
attr->u.stp_state);
break;
+ case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS:
+ err = port_attr_br_flags_pre_set(netdev, trans,
+ attr->u.brport_flags);
+ break;
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
err = port_attr_br_flags_set(netdev, trans,
attr->u.brport_flags);
--
2.17.1
^ permalink raw reply related
* [PATCH net-next v3 5/8] rocker: Check Handle PORT_PRE_BRIDGE_FLAGS
From: Florian Fainelli @ 2019-02-21 0:58 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, David S. Miller, Ido Schimmel, open list,
open list:STAGING SUBSYSTEM, moderated list:ETHERNET BRIDGE, jiri,
andrew, vivien.didelot
In-Reply-To: <20190221005826.26317-1-f.fainelli@gmail.com>
In preparation for getting rid of switchdev_port_attr_get(), have rocker
check for the bridge flags being set through switchdev_port_attr_set()
with the SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS attribute identifier.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/rocker/rocker_main.c | 55 +++++++++++++++++------
1 file changed, 41 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c
index 5ce8d5aba603..25129f7b5583 100644
--- a/drivers/net/ethernet/rocker/rocker_main.c
+++ b/drivers/net/ethernet/rocker/rocker_main.c
@@ -1566,34 +1566,57 @@ static int rocker_world_port_attr_stp_state_set(struct rocker_port *rocker_port,
}
static int
-rocker_world_port_attr_bridge_flags_set(struct rocker_port *rocker_port,
- unsigned long brport_flags,
- struct switchdev_trans *trans)
+rocker_world_port_attr_bridge_flags_support_get(const struct rocker_port *
+ rocker_port,
+ unsigned long *
+ p_brport_flags_support)
{
struct rocker_world_ops *wops = rocker_port->rocker->wops;
+ if (!wops->port_attr_bridge_flags_support_get)
+ return -EOPNOTSUPP;
+ return wops->port_attr_bridge_flags_support_get(rocker_port,
+ p_brport_flags_support);
+}
+
+static int
+rocker_world_port_attr_pre_bridge_flags_set(struct rocker_port *rocker_port,
+ unsigned long brport_flags,
+ struct switchdev_trans *trans)
+{
+ struct rocker_world_ops *wops = rocker_port->rocker->wops;
+ unsigned long brport_flags_s;
+ int err;
+
if (!wops->port_attr_bridge_flags_set)
return -EOPNOTSUPP;
- if (switchdev_trans_ph_prepare(trans))
- return 0;
+ err = rocker_world_port_attr_bridge_flags_support_get(rocker_port,
+ &brport_flags_s);
+ if (err)
+ return err;
- return wops->port_attr_bridge_flags_set(rocker_port, brport_flags,
- trans);
+ if (brport_flags & ~brport_flags_s)
+ return -EINVAL;
+
+ return 0;
}
static int
-rocker_world_port_attr_bridge_flags_support_get(const struct rocker_port *
- rocker_port,
- unsigned long *
- p_brport_flags_support)
+rocker_world_port_attr_bridge_flags_set(struct rocker_port *rocker_port,
+ unsigned long brport_flags,
+ struct switchdev_trans *trans)
{
struct rocker_world_ops *wops = rocker_port->rocker->wops;
- if (!wops->port_attr_bridge_flags_support_get)
+ if (!wops->port_attr_bridge_flags_set)
return -EOPNOTSUPP;
- return wops->port_attr_bridge_flags_support_get(rocker_port,
- p_brport_flags_support);
+
+ if (switchdev_trans_ph_prepare(trans))
+ return 0;
+
+ return wops->port_attr_bridge_flags_set(rocker_port, brport_flags,
+ trans);
}
static int
@@ -2074,6 +2097,10 @@ static int rocker_port_attr_set(struct net_device *dev,
attr->u.stp_state,
trans);
break;
+ case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS:
+ err = rocker_world_port_attr_pre_bridge_flags_set(rocker_port,
+ attr->u.brport_flags,
+ trans);
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
err = rocker_world_port_attr_bridge_flags_set(rocker_port,
attr->u.brport_flags,
--
2.17.1
^ permalink raw reply related
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