net: bridge: switchdev: check br_vlan_group() return value
Subsystems (3)
PATCH 1/1 net: bridge: switchdev: check br_vlan_group() return value
br_vlan_group() can return NULL and thus return value must be checked to avoid dereferencing a NULL pointer.
--- net/bridge/br_switchdev.c | 2 ++ 1 file changed, 2 insertions(+)
net/bridge/br_switchdev.c +2 -0
@@ -354,6 +354,8 @@ static int br_switchdev_vlan_attr_replay(struct net_device *br_dev, attr.orig_dev = br_dev; vg =br_vlan_group (br); +if (!vg) +return 0 ;list_for_each_entry (v, &vg->vlan_list, vlist) {if (v->msti) {
Signature · 1 line
2.34.1
Quoted 14 lines · Clément Léger
br_vlan_group()can return NULL and thus return value must be checked to avoid dereferencing a NULL pointer.Fixes 6284c723d9b9 ("net: bridge: mst: Notify switchdev drivers of VLAN MSTI migrations")Signed-off-by Clément Léger <[email protected]>--- net/bridge/br_switchdev.c | 2 ++ 1 file changed, 2 insertions(+)net/bridge/br_switchdev.c +0
-0
net/bridge/br_switchdev.c static int br_switchdev_vlan_attr_replay(struct net_device *br_dev, · line 361
Quoted 8 lines
net/bridge/br_switchdev.c +2
-0@@ -354,6 +354,8 @@ static int br_switchdev_vlan_attr_replay(struct net_device *br_dev, attr.orig_dev = br_dev; vg =br_vlan_group (br); +if (!vg) +return 0 ;list_for_each_entry (v, &vg->vlan_list, vlist) {if (v->msti) {
Good catch.
Jakub Kicinski
maintainerQuoted 17 lines · On Thu, 21 Apr 2022 13:17:51 +0300 Nikolay Aleksandrov wrote:
Quoted 16 lines · Clément Léger
br_vlan_group()can return NULL and thus return value must be checked to avoid dereferencing a NULL pointer.Fixes 6284c723d9b9 ("net: bridge: mst: Notify switchdev drivers of VLAN MSTI migrations")Signed-off-by Clément Léger <[email protected]>--- net/bridge/br_switchdev.c | 2 ++ 1 file changed, 2 insertions(+)net/bridge/br_switchdev.c +0
-0@@ -354,6 +354,8 @@ static int br_switchdev_vlan_attr_replay(struct net_device *br_dev, attr.orig_dev = br_dev;
Quoted 8 lines
net/bridge/br_switchdev.c static int br_switchdev_vlan_attr_replay(struct net_device *br_dev, · line 361
Quoted 6 lines
net/bridge/br_switchdev.c +2
-0vg =br_vlan_group (br); +if (!vg) +return 0 ;list_for_each_entry (v, &vg->vlan_list, vlist) {if (v->msti) {
Thanks! Applying to net tho, the patch in question is already in Linus's tree.
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Thu, 21 Apr 2022 12:12:47 +0200 you wrote:
br_vlan_group()can return NULL and thus return value must be checked to avoid dereferencing a NULL pointer.Fixes 6284c723d9b9 ("net: bridge: mst: Notify switchdev drivers of VLAN MSTI migrations")Signed-off-by Clément Léger <[email protected]>--- net/bridge/br_switchdev.c | 2 ++ 1 file changed, 2 insertions(+)
Here is the summary with links:
- [net-next] net: bridge: switchdev: check br_vlan_group() return value
https://git.kernel.org/netdev/net/c/7f40ea2145d9
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html