• Daniel Borkmann's avatar
    rtnetlink: ifla_vf_policy: fix misuses of NLA_BINARY · 1f18b807
    Daniel Borkmann authored
    commit 364d5716 upstream.
    
    ifla_vf_policy[] is wrong in advertising its individual member types as
    NLA_BINARY since .type = NLA_BINARY in combination with .len declares the
    len member as *max* attribute length [0, len].
    
    The issue is that when do_setvfinfo() is being called to set up a VF
    through ndo handler, we could set corrupted data if the attribute length
    is less than the size of the related structure itself.
    
    The intent is exactly the opposite, namely to make sure to pass at least
    data of minimum size of len.
    
    Fixes: ebc08a6f ("rtnetlink: Add VF config code to rtnetlink")
    Cc: Mitch Williams <mitch.a.williams@intel.com>
    Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Acked-by: default avatarThomas Graf <tgraf@suug.ch>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    [lizf: Backported to 3.4: drop changes to IFLA_VF_RATE and IFLA_VF_LINK_STATE]
    Signed-off-by: default avatarZefan Li <lizefan@huawei.com>
    1f18b807
rtnetlink.c 51.4 KB