]> git.baikalelectronics.ru Git - kernel.git/commit
rtnetlink: ifla_vf_policy: fix misuses of NLA_BINARY
authorDaniel Borkmann <daniel@iogearbox.net>
Thu, 5 Feb 2015 17:44:04 +0000 (18:44 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 8 Feb 2015 06:13:10 +0000 (22:13 -0800)
commitafc8b25c0c5e4b728d0eced855fabcaa95305f23
tree4f7516628df9555580d33e9c6092ba40e9d41c65
parent383252badb21bd660ea6a4f10f308014ec125f1a
rtnetlink: ifla_vf_policy: fix misuses of NLA_BINARY

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: a6b4b5954c93 ("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: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/rtnetlink.c