2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

netdev-linux: Fix use of uninitialized LAG master name.

'if_indextoname' may fail leaving the 'master_name' uninitialized:

 Conditional jump or move depends on uninitialised value(s)
    at 0x4C34329: strlen (vg_replace_strmem.c:459)
    by 0x51C638: hash_string (hash.h:342)
    by 0x51C638: hash_name (shash.c:28)
    by 0x51CC51: shash_find (shash.c:231)
    by 0x51CD38: shash_find_data (shash.c:245)
    by 0x4A797F: netdev_from_name (netdev.c:2013)
    by 0x544148: netdev_linux_update_lag (netdev-linux.c:676)
    by 0x544148: netdev_linux_run (netdev-linux.c:769)
    by 0x4A5997: netdev_run (netdev.c:186)
    by 0x40752B: main (ovs-vswitchd.c:129)
  Uninitialised value was created by a stack allocation
    at 0x543AFA: netdev_linux_run (netdev-linux.c:722)

Fixes: d22f8927c3 ("netdev-linux: monitor and offload LAG slaves to TC")
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Acked-by: Mark D. Gray <mark.d.gray@redhat.com>
This commit is contained in:
Ilya Maximets
2021-04-04 19:31:42 +02:00
parent 0b3ff31d35
commit 577b9a8169

View File

@@ -672,7 +672,9 @@ netdev_linux_update_lag(struct rtnetlink_change *change)
uint32_t block_id;
int error = 0;
if_indextoname(change->master_ifindex, master_name);
if (!if_indextoname(change->master_ifindex, master_name)) {
return;
}
master_netdev = netdev_from_name(master_name);
if (!master_netdev) {
return;