lists.openwall.net   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  linux-cve-announce  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:   Thu, 18 Apr 2019 04:31:16 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     David Miller <davem@...emloft.net>
Cc:     netdev <netdev@...r.kernel.org>,
        Florian Fainelli <f.fainelli@...il.com>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Andrew Lunn <andrew@...n.ch>
Subject: [PATCH net-next 11/15] dsa: Add stub tag driver put method

When a DSA switch driver is unloaded, the lock on the tag driver
should be released so the module can be unloaded. Add the needed calls,
but leave the actual relase code as a stub.

Signed-off-by: Andrew Lunn <andrew@...n.ch>
---
 net/dsa/dsa.c      | 4 ++++
 net/dsa/dsa2.c     | 2 ++
 net/dsa/dsa_priv.h | 1 +
 net/dsa/legacy.c   | 2 ++
 4 files changed, 9 insertions(+)

diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 5e99f291723f..a3210b2f88a2 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -141,6 +141,10 @@ const struct dsa_device_ops *dsa_tag_driver_get(int tag_protocol)
 	return ops;
 }
 
+void dsa_tag_driver_put(const struct dsa_device_ops *ops)
+{
+}
+
 static int dev_is_class(struct device *dev, void *class)
 {
 	if (dev->class != NULL && !strcmp(dev->class->name, class))
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index ba91bda8bdd3..efc51a9dc9c8 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -335,6 +335,8 @@ static void dsa_port_teardown(struct dsa_port *dp)
 	case DSA_PORT_TYPE_UNUSED:
 		break;
 	case DSA_PORT_TYPE_CPU:
+		dsa_tag_driver_put(dp->tag_ops);
+		/* fall thought */
 	case DSA_PORT_TYPE_DSA:
 		dsa_port_link_unregister_of(dp);
 		break;
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index d7dbdf06e437..ec002a7c8a58 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -85,6 +85,7 @@ struct dsa_slave_priv {
 
 /* dsa.c */
 const struct dsa_device_ops *dsa_tag_driver_get(int tag_protocol);
+void dsa_tag_driver_put(const struct dsa_device_ops *ops);
 
 bool dsa_schedule_work(struct work_struct *work);
 const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops);
diff --git a/net/dsa/legacy.c b/net/dsa/legacy.c
index a8c076250237..219f4fa7ff4b 100644
--- a/net/dsa/legacy.c
+++ b/net/dsa/legacy.c
@@ -163,6 +163,8 @@ static int dsa_switch_setup_one(struct dsa_switch *ds,
 		dst->cpu_dp->dst = dst;
 	}
 
+	dsa_tag_driver_put(dst->cpu_dp->tag_ops);
+
 	memcpy(ds->rtable, cd->rtable, sizeof(ds->rtable));
 
 	/*
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ