lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 22 May 2020 00:10:32 +0300
From:   Vladimir Oltean <>
Subject: [PATCH RFC net-next 09/13] net: dsa: mroute: don't panic the kernel if called without the prepare phase

From: Vladimir Oltean <>

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 <>
 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);

Powered by blists - more mailing lists