Skip to content

Commit a7789fd

Browse files
name2965kuba-moo
authored andcommitted
net: hsr: prevent NULL pointer dereference in hsr_proxy_announce()
In the function hsr_proxy_annouance() added in the previous commit 5f703ce ("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: [email protected] Fixes: 5f703ce ("net: hsr: Send supervisory frames to HSR network with ProxyNodeTable data") Signed-off-by: Jeongjun Park <[email protected]> Reviewed-by: Simon Horman <[email protected]> Acked-by: Lukasz Majewski <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 6254031 commit a7789fd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net/hsr/hsr_device.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,9 @@ static void hsr_proxy_announce(struct timer_list *t)
414414
* of SAN nodes stored in ProxyNodeTable.
415415
*/
416416
interlink = hsr_port_get_hsr(hsr, HSR_PT_INTERLINK);
417+
if (!interlink)
418+
goto done;
419+
417420
list_for_each_entry_rcu(node, &hsr->proxy_node_db, mac_list) {
418421
if (hsr_addr_is_redbox(hsr, node->macaddress_A))
419422
continue;
@@ -428,6 +431,7 @@ static void hsr_proxy_announce(struct timer_list *t)
428431
mod_timer(&hsr->announce_proxy_timer, jiffies + interval);
429432
}
430433

434+
done:
431435
rcu_read_unlock();
432436
}
433437

0 commit comments

Comments
 (0)