net: dsa: don't assign an error value to tag_ops
authorGeorge McCollister <george.mccollister@gmail.com>
Mon, 22 Mar 2021 20:26:50 +0000 (15:26 -0500)
committerDavid S. Miller <davem@davemloft.net>
Tue, 23 Mar 2021 00:24:42 +0000 (17:24 -0700)
commite0c755a45f6fb6e81e3a62a94db0400ef0cdc046
tree26bf59d9931d5a7a17ff69a0dad67caaf74e00f6
parent8fb16e80cb467a6edfec8c83117ea9703279d8db
net: dsa: don't assign an error value to tag_ops

Use a temporary variable to hold the return value from
dsa_tag_driver_get() instead of assigning it to dst->tag_ops. Leaving
an error value in dst->tag_ops can result in deferencing an invalid
pointer when a deferred switch configuration happens later.

Fixes: 357f203bb3b5 ("net: dsa: keep a copy of the tagging protocol in the DSA switch tree")

Signed-off-by: George McCollister <george.mccollister@gmail.com>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/dsa2.c