Commit 199f4baf authored by Mintz, Yuval's avatar Mintz, Yuval Committed by Greg Kroah-Hartman

net: Zero ifla_vf_info in rtnl_fill_vfinfo()


[ Upstream commit 0eed9cf5 ]

Some of the structure's fields are not initialized by the
rtnetlink. If driver doesn't set those in ndo_get_vf_config(),
they'd leak memory to user.
Signed-off-by: default avatarYuval Mintz <Yuval.Mintz@cavium.com>
CC: Michal Schmidt <mschmidt@redhat.com>
Reviewed-by: default avatarGreg Rose <gvrose8192@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d8d01fc9
...@@ -1127,6 +1127,8 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, ...@@ -1127,6 +1127,8 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
struct ifla_vf_mac vf_mac; struct ifla_vf_mac vf_mac;
struct ifla_vf_info ivi; struct ifla_vf_info ivi;
memset(&ivi, 0, sizeof(ivi));
/* Not all SR-IOV capable drivers support the /* Not all SR-IOV capable drivers support the
* spoofcheck and "RSS query enable" query. Preset to * spoofcheck and "RSS query enable" query. Preset to
* -1 so the user space tool can detect that the driver * -1 so the user space tool can detect that the driver
...@@ -1135,7 +1137,6 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, ...@@ -1135,7 +1137,6 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
ivi.spoofchk = -1; ivi.spoofchk = -1;
ivi.rss_query_en = -1; ivi.rss_query_en = -1;
ivi.trusted = -1; ivi.trusted = -1;
memset(ivi.mac, 0, sizeof(ivi.mac));
/* The default value for VF link state is "auto" /* The default value for VF link state is "auto"
* IFLA_VF_LINK_STATE_AUTO which equals zero * IFLA_VF_LINK_STATE_AUTO which equals zero
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment