On 04/04/2021 18:31, Ilya Maximets wrote:
> '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)
> 
> CC: John Hurley <[email protected]>
> Fixes: d22f8927c3c9 ("netdev-linux: monitor and offload LAG slaves to TC")
> Signed-off-by: Ilya Maximets <[email protected]>
> ---
>  lib/netdev-linux.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
> index 15b25084b..2b8283e94 100644
> --- a/lib/netdev-linux.c
> +++ b/lib/netdev-linux.c
> @@ -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;
> 
Interesting that strlen() doesn't check for NULL. LGTM

Acked-by: Mark D. Gray <[email protected]>

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to