linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: dsa: Prevent usage of NET_DSA_TAG_8021Q as tagging protocol
@ 2019-11-11 19:54 Florian Fainelli
  2019-11-11 19:55 ` Florian Fainelli
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2019-11-11 19:54 UTC (permalink / raw)
  To: netdev
  Cc: olteanv, Florian Fainelli, Andrew Lunn, Vivien Didelot,
	David S. Miller, open list

It is possible for a switch driver to use NET_DSA_TAG_8021Q as a valid
DSA tagging protocol since it registers itself as such, unfortunately
since there are not xmit or rcv functions provided, the lack of a xmit()
function will lead to a NPD in dsa_slave_xmit() to start with.

net/dsa/tag_8021q.c is only comprised of a set of helper functions at
the moment, but is not a fully autonomous or functional tagging "driver"
(though it could become later on). We do not have any users of
NET_DSA_TAG_8021Q so now is a good time to make sure there are not
issues being encountered by making this file strictly a place holder for
helper functions.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 net/dsa/Kconfig     |  2 +-
 net/dsa/tag_8021q.c | 11 -----------
 2 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
index 29e2bd5cc5af..136612792c08 100644
--- a/net/dsa/Kconfig
+++ b/net/dsa/Kconfig
@@ -20,7 +20,7 @@ if NET_DSA
 
 # tagging formats
 config NET_DSA_TAG_8021Q
-	tristate "Tag driver for switches using custom 802.1Q VLAN headers"
+	tristate
 	select VLAN_8021Q
 	help
 	  Unlike the other tagging protocols, the 802.1Q config option simply
diff --git a/net/dsa/tag_8021q.c b/net/dsa/tag_8021q.c
index 9c1cc2482b68..f54f4a778821 100644
--- a/net/dsa/tag_8021q.c
+++ b/net/dsa/tag_8021q.c
@@ -341,14 +341,3 @@ struct sk_buff *dsa_8021q_remove_header(struct sk_buff *skb)
 	return skb;
 }
 EXPORT_SYMBOL_GPL(dsa_8021q_remove_header);
-
-static const struct dsa_device_ops dsa_8021q_netdev_ops = {
-	.name		= "8021q",
-	.proto		= DSA_TAG_PROTO_8021Q,
-	.overhead	= VLAN_HLEN,
-};
-
-MODULE_LICENSE("GPL v2");
-MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_8021Q);
-
-module_dsa_tag_driver(dsa_8021q_netdev_ops);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: dsa: Prevent usage of NET_DSA_TAG_8021Q as tagging protocol
  2019-11-11 19:54 [PATCH net-next] net: dsa: Prevent usage of NET_DSA_TAG_8021Q as tagging protocol Florian Fainelli
@ 2019-11-11 19:55 ` Florian Fainelli
  2019-11-11 21:29   ` Vladimir Oltean
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2019-11-11 19:55 UTC (permalink / raw)
  To: netdev; +Cc: olteanv, Andrew Lunn, Vivien Didelot, David S. Miller, open list

On 11/11/19 11:54 AM, Florian Fainelli wrote:
> It is possible for a switch driver to use NET_DSA_TAG_8021Q as a valid
> DSA tagging protocol since it registers itself as such, unfortunately
> since there are not xmit or rcv functions provided, the lack of a xmit()
> function will lead to a NPD in dsa_slave_xmit() to start with.
> 
> net/dsa/tag_8021q.c is only comprised of a set of helper functions at
> the moment, but is not a fully autonomous or functional tagging "driver"
> (though it could become later on). We do not have any users of
> NET_DSA_TAG_8021Q so now is a good time to make sure there are not
> issues being encountered by making this file strictly a place holder for
> helper functions.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---

[snip]

> -static const struct dsa_device_ops dsa_8021q_netdev_ops = {
> -	.name		= "8021q",
> -	.proto		= DSA_TAG_PROTO_8021Q,
> -	.overhead	= VLAN_HLEN,
> -};
> -
> -MODULE_LICENSE("GPL v2");

I probably need to keep that around to avoid complaints about the module
tainting the kernel, expect a v2 based on that and/or reviewer comments.
-- 
Florian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: dsa: Prevent usage of NET_DSA_TAG_8021Q as tagging protocol
  2019-11-11 19:55 ` Florian Fainelli
@ 2019-11-11 21:29   ` Vladimir Oltean
  0 siblings, 0 replies; 3+ messages in thread
From: Vladimir Oltean @ 2019-11-11 21:29 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, Andrew Lunn, Vivien Didelot, David S. Miller, open list

On Mon, 11 Nov 2019 at 21:55, Florian Fainelli <f.fainelli@gmail.com> wrote:
>
> On 11/11/19 11:54 AM, Florian Fainelli wrote:
> > It is possible for a switch driver to use NET_DSA_TAG_8021Q as a valid
> > DSA tagging protocol since it registers itself as such, unfortunately
> > since there are not xmit or rcv functions provided, the lack of a xmit()
> > function will lead to a NPD in dsa_slave_xmit() to start with.
> >
> > net/dsa/tag_8021q.c is only comprised of a set of helper functions at
> > the moment, but is not a fully autonomous or functional tagging "driver"
> > (though it could become later on). We do not have any users of
> > NET_DSA_TAG_8021Q so now is a good time to make sure there are not
> > issues being encountered by making this file strictly a place holder for
> > helper functions.
> >
> > Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> > ---
>
> [snip]
>
> > -static const struct dsa_device_ops dsa_8021q_netdev_ops = {
> > -     .name           = "8021q",
> > -     .proto          = DSA_TAG_PROTO_8021Q,
> > -     .overhead       = VLAN_HLEN,
> > -};
> > -
> > -MODULE_LICENSE("GPL v2");
>
> I probably need to keep that around to avoid complaints about the module
> tainting the kernel, expect a v2 based on that and/or reviewer comments.
> --
> Florian

Actually I wanted to see the tainting in action. But it's worse than
that, due to the use of exported GPL symbols.

insmod tag_8021q.ko
[   68.205843] tag_8021q: module license 'unspecified' taints kernel.
[   68.212183] Disabling lock debugging due to kernel taint
[   68.217876] tag_8021q: Unknown symbol skb_pull_rcsum (err -2)
[   68.223781] tag_8021q: Unknown symbol br_vlan_get_info (err -2)
[   68.229675] tag_8021q: Unknown symbol br_vlan_get_pvid (err -2)
insmod: ERROR: could not insert module tag_8021q.ko: Unknown symbol in module

So you can add on v2:

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-11 21:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-11 19:54 [PATCH net-next] net: dsa: Prevent usage of NET_DSA_TAG_8021Q as tagging protocol Florian Fainelli
2019-11-11 19:55 ` Florian Fainelli
2019-11-11 21:29   ` Vladimir Oltean

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