diff options
| author | Jeongjun Park <aha310510@gmail.com> | 2024-09-08 04:03:41 +0900 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-09-18 19:25:16 +0200 |
| commit | 8d0c3368478e517edba136294ad426c1a7cd176a (patch) | |
| tree | 99bccd89800a75acc19ca5c568962a112e83fb0b /net | |
| parent | 1f68e097e20d3c695281a9c6433acc37be47fe11 (diff) | |
| download | linux-8d0c3368478e517edba136294ad426c1a7cd176a.tar.gz linux-8d0c3368478e517edba136294ad426c1a7cd176a.tar.bz2 linux-8d0c3368478e517edba136294ad426c1a7cd176a.zip | |
net: hsr: prevent NULL pointer dereference in hsr_proxy_announce()
[ Upstream commit a7789fd4caaf96ecfed5e28c4cddb927e6bebadb ]
In the function hsr_proxy_annouance() added in the previous commit
5f703ce5c981 ("net: hsr: Send supervisory frames to HSR network
with ProxyNodeTable data"), the return value of the hsr_port_get_hsr()
function is not checked to be a NULL pointer, which causes a NULL
pointer dereference.
To solve this, we need to add code to check whether the return value
of hsr_port_get_hsr() is NULL.
Reported-by: syzbot+02a42d9b1bd395cbcab4@syzkaller.appspotmail.com
Fixes: 5f703ce5c981 ("net: hsr: Send supervisory frames to HSR network with ProxyNodeTable data")
Signed-off-by: Jeongjun Park <aha310510@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Acked-by: Lukasz Majewski <lukma@denx.de>
Link: https://patch.msgid.link/20240907190341.162289-1-aha310510@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
| -rw-r--r-- | net/hsr/hsr_device.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c index e4cc6b78dcfc..b3191968e53a 100644 --- a/net/hsr/hsr_device.c +++ b/net/hsr/hsr_device.c @@ -427,6 +427,9 @@ static void hsr_proxy_announce(struct timer_list *t) * of SAN nodes stored in ProxyNodeTable. */ interlink = hsr_port_get_hsr(hsr, HSR_PT_INTERLINK); + if (!interlink) + goto done; + list_for_each_entry_rcu(node, &hsr->proxy_node_db, mac_list) { if (hsr_addr_is_redbox(hsr, node->macaddress_A)) continue; @@ -441,6 +444,7 @@ static void hsr_proxy_announce(struct timer_list *t) mod_timer(&hsr->announce_proxy_timer, jiffies + interval); } +done: rcu_read_unlock(); } |
