]> git.baikalelectronics.ru Git - kernel.git/commit
net: ethernet: ti: am65-cpsw: fix crash in am65_cpsw_port_offload_fwd_mark_update()
authorGrygorii Strashko <grygorii.strashko@ti.com>
Thu, 5 Aug 2021 10:14:09 +0000 (13:14 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 5 Aug 2021 12:33:23 +0000 (13:33 +0100)
commite0e1fb470306d7fa9cb55a5e796221bbaa73714b
treec5ff52c748f3d829b55d381f3be477e502063dcf
parent0a9e98bdba990fbf7c672f68d7ad56e336168f18
net: ethernet: ti: am65-cpsw: fix crash in am65_cpsw_port_offload_fwd_mark_update()

The am65_cpsw_port_offload_fwd_mark_update() causes NULL exception crash
when there is at least one disabled port and any other port added to the
bridge first time.

Unable to handle kernel NULL pointer dereference at virtual address 0000000000000858
pc : am65_cpsw_port_offload_fwd_mark_update+0x54/0x68
lr : am65_cpsw_netdevice_event+0x8c/0xf0
Call trace:
am65_cpsw_port_offload_fwd_mark_update+0x54/0x68
notifier_call_chain+0x54/0x98
raw_notifier_call_chain+0x14/0x20
call_netdevice_notifiers_info+0x34/0x78
__netdev_upper_dev_link+0x1c8/0x290
netdev_master_upper_dev_link+0x1c/0x28
br_add_if+0x3f0/0x6d0 [bridge]

Fix it by adding proper check for port->ndev != NULL.

Fixes: 8c36b1dc0493 ("net: ti: am65-cpsw-nuss: Add netdevice notifiers")
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ti/am65-cpsw-nuss.c