author: Vladimir Oltean <vladimir.oltean@nxp.com> 2023-07-01 01:20:10 +0300
committer: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 2023-07-19 16:36:46 +0200
commit: ea08220190361ac35a4e77d40cff639c21c26f42
parent: f8fe2df13a0fe3e4044cf148615031a77d4f7c35
Commit Summary:
Diffstat:
1 file changed, 6 insertions, 3 deletions
diff --git a/net/dsa/tag_sja1105.c b/net/dsa/tag_sja1105.c
index 92a626a05e82..db0a6ac67470 100644
--- a/net/dsa/tag_sja1105.c
+++ b/net/dsa/tag_sja1105.c
@@ -573,11 +573,14 @@ static struct sk_buff *sja1105_rcv(struct sk_buff *skb,
* if available. This allows us to not overwrite a valid source
* port and switch ID with zeroes when receiving link-local
* frames from a VLAN-unaware bridged port (non-zero vbid) or a
- * VLAN-aware bridged port (non-zero vid).
+ * VLAN-aware bridged port (non-zero vid). Furthermore, the
+ * tag_8021q source port information is only of trust when the
+ * vbid is 0 (precise port). Otherwise, tmp_source_port and
+ * tmp_switch_id will be zeroes.
*/
- if (source_port == -1)
+ if (vbid == 0 && source_port == -1)
source_port = tmp_source_port;
- if (switch_id == -1)
+ if (vbid == 0 && switch_id == -1)
switch_id = tmp_switch_id;
} else if (source_port == -1 && switch_id == -1) {
/* Packets with no source information have no chance of