From: Vladimir Oltean <olteanv@gmail.com>
To: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com,
davem@davemloft.net
Cc: jiri@resnulli.us, idosch@idosch.org, kuba@kernel.org,
ivecera@redhat.com, netdev@vger.kernel.org,
horatiu.vultur@microchip.com, allan.nielsen@microchip.com,
nikolay@cumulusnetworks.com, roopa@cumulusnetworks.com
Subject: [PATCH RFC net-next 09/13] net: dsa: mroute: don't panic the kernel if called without the prepare phase
Date: Fri, 22 May 2020 00:10:32 +0300 [thread overview]
Message-ID: <20200521211036.668624-10-olteanv@gmail.com> (raw)
In-Reply-To: <20200521211036.668624-1-olteanv@gmail.com>
From: Vladimir Oltean <vladimir.oltean@nxp.com>
Currently, this function would check the port_egress_floods pointer only
in the preparation phase, the assumption being that the caller wouldn't
proceed to a second call since it returned -EOPNOTSUPP. If the function
were to be called a second time though, the port_egress_floods pointer
would not be checked and the driver would proceed to dereference it.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
net/dsa/port.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/dsa/port.c b/net/dsa/port.c
index e23ece229c7e..c4032f79225a 100644
--- a/net/dsa/port.c
+++ b/net/dsa/port.c
@@ -324,8 +324,11 @@ int dsa_port_mrouter(struct dsa_port *dp, bool mrouter,
struct dsa_switch *ds = dp->ds;
int port = dp->index;
+ if (!ds->ops->port_egress_floods)
+ return -EOPNOTSUPP;
+
if (switchdev_trans_ph_prepare(trans))
- return ds->ops->port_egress_floods ? 0 : -EOPNOTSUPP;
+ return 0;
return ds->ops->port_egress_floods(ds, port, true, mrouter);
}
--
2.25.1
next prev parent reply other threads:[~2020-05-21 21:11 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-21 21:10 [PATCH RFC net-next 00/13] RX filtering for DSA switches Vladimir Oltean
2020-05-21 21:10 ` [PATCH RFC net-next 01/13] net: core: dev_addr_lists: add VID to device address Vladimir Oltean
2020-05-21 21:10 ` [PATCH RFC net-next 02/13] net: 8021q: vlan_dev: add vid tag to addresses of uc and mc lists Vladimir Oltean
2020-05-21 21:10 ` [PATCH RFC net-next 03/13] net: 8021q: vlan_dev: add vid tag for vlan device own address Vladimir Oltean
2020-05-21 21:10 ` [PATCH RFC net-next 04/13] ethernet: eth: add default vid len for all ethernet kind devices Vladimir Oltean
2020-05-21 21:10 ` [PATCH RFC net-next 05/13] net: bridge: multicast: propagate br_mc_disabled_update() return Vladimir Oltean
2020-05-21 21:10 ` [PATCH RFC net-next 06/13] net: core: dev_addr_lists: export some raw __hw_addr helpers Vladimir Oltean
2020-05-21 21:10 ` [PATCH RFC net-next 07/13] net: dsa: don't use switchdev_notifier_fdb_info in dsa_switchdev_event_work Vladimir Oltean
2020-05-21 21:10 ` [PATCH RFC net-next 08/13] net: dsa: add ability to program unicast and multicast filters for CPU port Vladimir Oltean
2020-05-21 21:10 ` Vladimir Oltean [this message]
2020-05-21 21:10 ` [PATCH RFC net-next 10/13] net: bridge: add port flags for host flooding Vladimir Oltean
2020-05-22 12:38 ` Nikolay Aleksandrov
2020-05-22 13:13 ` Vladimir Oltean
2020-05-22 18:45 ` Allan W. Nielsen
2020-07-20 11:08 ` Vladimir Oltean
2020-05-24 14:26 ` Ido Schimmel
2020-05-24 16:13 ` Vladimir Oltean
2020-05-25 20:11 ` Ido Schimmel
2020-05-25 20:32 ` Vladimir Oltean
2020-07-23 22:35 ` Vladimir Oltean
2020-07-27 17:15 ` Ido Schimmel
2020-05-21 21:10 ` [PATCH RFC net-next 11/13] net: dsa: deal with new flooding port attributes from bridge Vladimir Oltean
2020-05-21 21:10 ` [PATCH RFC net-next 12/13] net: dsa: treat switchdev notifications for multicast router connected to port Vladimir Oltean
2020-05-21 21:10 ` [PATCH RFC net-next 13/13] net: dsa: wire up multicast IGMP snooping attribute notification Vladimir Oltean
2020-05-22 18:42 ` [PATCH RFC net-next 00/13] RX filtering for DSA switches Allan W. Nielsen
2020-05-24 14:06 ` Ido Schimmel
2020-05-24 16:24 ` Vladimir Oltean
2020-05-25 19:48 ` Ido Schimmel
2020-05-25 20:23 ` Vladimir Oltean
2020-05-26 14:01 ` Ido Schimmel
2020-05-27 11:36 ` Vladimir Oltean
2020-05-28 14:37 ` Ido Schimmel
2020-07-20 10:00 ` Vladimir Oltean
2020-07-27 16:56 ` Ido Schimmel
2020-10-27 11:52 ` Vladimir Oltean
2020-10-28 14:43 ` Ido Schimmel
2020-10-28 18:46 ` Vladimir Oltean
2020-11-01 11:27 ` Ido Schimmel
2020-11-01 12:06 ` Vladimir Oltean
2020-11-01 14:42 ` Ido Schimmel
2020-11-01 15:04 ` Vladimir Oltean
2020-11-01 15:39 ` Ido Schimmel
2020-11-01 16:13 ` Vladimir Oltean
2020-11-11 4:12 ` Florian Fainelli
2020-05-24 16:13 ` Florian Fainelli
2020-05-24 16:34 ` Vladimir Oltean
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200521211036.668624-10-olteanv@gmail.com \
--to=olteanv@gmail.com \
--cc=allan.nielsen@microchip.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=horatiu.vultur@microchip.com \
--cc=idosch@idosch.org \
--cc=ivecera@redhat.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nikolay@cumulusnetworks.com \
--cc=roopa@cumulusnetworks.com \
--cc=vivien.didelot@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).