linux/net
Daniel Borkmann 39347e759a rtnetlink: verify IFLA_VF_INFO attributes before passing them to driver
commit 4f7d2cdfdd upstream.

Jason Gunthorpe reported that since commit c02db8c629 ("rtnetlink: make
SR-IOV VF interface symmetric"), we don't verify IFLA_VF_INFO attributes
anymore with respect to their policy, that is, ifla_vfinfo_policy[].

Before, they were part of ifla_policy[], but they have been nested since
placed under IFLA_VFINFO_LIST, that contains the attribute IFLA_VF_INFO,
which is another nested attribute for the actual VF attributes such as
IFLA_VF_MAC, IFLA_VF_VLAN, etc.

Despite the policy being split out from ifla_policy[] in this commit,
it's never applied anywhere. nla_for_each_nested() only does basic nla_ok()
testing for struct nlattr, but it doesn't know about the data context and
their requirements.

Fix, on top of Jason's initial work, does 1) parsing of the attributes
with the right policy, and 2) using the resulting parsed attribute table
from 1) instead of the nla_for_each_nested() loop (just like we used to
do when still part of ifla_policy[]).

Reference: http://thread.gmane.org/gmane.linux.network/368913
Fixes: c02db8c629 ("rtnetlink: make SR-IOV VF interface symmetric")
Reported-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Cc: Chris Wright <chrisw@sous-sol.org>
Cc: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Cc: Greg Rose <gregory.v.rose@intel.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: Rony Efraim <ronye@mellanox.com>
Cc: Vlad Zolotarov <vladz@cloudius-systems.com>
Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Cc: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Vlad Zolotarov <vladz@cloudius-systems.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[ luis: backported to 3.16: used davem's backport to 3.18 ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
History 2015-08-27 13:30:18 +01:00
..
9p 9p: forgetting to cancel request on interrupted zero-copy RPC 2015-07-15 10:01:13 +01:00
802 neigh: use NEIGH_VAR_INIT in ndo_neigh_setup functions. 2014-01-16 11:31:58 -08:00
8021q net: Always untag vlan-tagged traffic on input. 2014-10-15 12:05:26 +02:00
appletalk appletalk: Fix socket referencing in skb 2014-07-08 19:39:43 -07:00
atm Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-06-12 14:27:40 -07:00
ax25 net: Fix use after free by removing length arg from sk_data_ready callbacks. 2014-04-11 16:15:36 -04:00
batman-adv batman-adv: avoid NULL dereferences and fix if check 2015-01-19 11:21:16 +00:00
bluetooth Bluetooth: Fix LE connection timeout deadlock 2015-01-05 13:33:42 +00:00
bridge bridge: mdb: fix delmdb state in the notification 2015-08-25 10:13:53 +01:00
caif unix/caif: sk_socket can disappear when state is unlocked 2015-06-12 13:30:18 +01:00
can can: add missing initialisations in CAN related skbuffs 2015-03-23 15:16:47 +00:00
ceph crush: fix a bug in tree bucket decode 2015-07-15 10:01:02 +01:00
core rtnetlink: verify IFLA_VF_INFO attributes before passing them to driver 2015-08-27 13:30:18 +01:00
dcb net: Use netlink_ns_capable to verify the permisions of netlink messages 2014-04-24 13:44:54 -04:00
dccp net: Eliminate no_check from protosw 2014-05-23 16:28:53 -04:00
decnet net: Split sk_no_check into sk_no_check_{rx,tx} 2014-05-23 16:28:53 -04:00
dns_resolver dns_resolver: Null-terminate the right string 2014-07-20 22:33:32 -07:00
dsa net: dsa: Fix off-by-one in switch address parsing 2015-08-10 17:10:19 +01:00
ethernet net: eth_type_trans() should use skb_header_pointer() 2014-01-16 15:30:31 -08:00
hsr hsr: replace del_timer by del_timer_sync 2014-03-27 15:28:06 -04:00
ieee802154 ieee802154: Fix sockaddr_ieee802154 implicit padding information leak. 2015-07-15 10:00:19 +01:00
ipv4 inet: frags: fix defragmented packet's IP header for af_packet 2015-08-12 09:48:31 +01:00
ipv6 ipv6: Make MLD packets to only be processed locally 2015-08-10 17:10:15 +01:00
ipx ipx: fix locking regression in ipx_sendmsg and ipx_recvmsg 2014-12-01 10:02:10 +00:00
irda net: irda: fix wait_until_sent poll timeout 2015-03-18 15:07:25 +00:00
iucv af_iucv: correct cleanup if listen backlog is full 2014-05-30 17:35:23 -07:00
key af_key: Replace comma with semicolon 2014-05-30 17:48:58 -07:00
l2tp l2tp: fix race while getting PMTU on PPP pseudo-wire 2014-10-15 12:05:28 +02:00
lapb net/lapb: re-send packets on timeout 2013-09-23 16:52:45 -04:00
llc net: llc: use correct size for sysctl timeout entries 2015-03-02 15:04:42 +00:00
mac80211 mac80211: clear subdir_stations when removing debugfs 2015-08-11 09:57:34 +01:00
mac802154 mac802154: don't deliver packets to devices that are down 2014-06-11 12:10:19 -07:00
mpls gre: Call gso_make_checksum 2014-06-04 22:46:38 -07:00
netfilter netfilter: nf_conntrack: Support expectations in different zones 2015-08-25 10:13:49 +01:00
netlabel netlabel: Fix FSF address in file headers 2013-12-06 12:37:56 -05:00
netlink net: fix crash in build_skb() 2015-04-29 11:39:51 +01:00
netrom net: Fix use after free by removing length arg from sk_data_ready callbacks. 2014-04-11 16:15:36 -04:00
nfc net: add __pskb_copy_fclone and pskb_copy_for_clone 2014-06-11 15:38:02 -07:00
openvswitch net: make skb_gso_segment error handling more robust 2015-05-20 13:25:55 +01:00
packet packet: tpacket_snd(): fix signed/unsigned comparison 2015-08-25 10:13:53 +01:00
phonet net: Use netlink_ns_capable to verify the permisions of netlink messages 2014-04-24 13:44:54 -04:00
rds rds: rds_ib_device.refcount overflow 2015-08-11 09:57:26 +01:00
rfkill Merge git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next 2014-05-22 13:58:36 -04:00
rose NET: ROSE: Don't dereference NULL neighbour pointer. 2015-07-15 10:00:49 +01:00
rxrpc rxrpc: bogus MSG_PEEK test in rxrpc_recvmsg() 2015-03-24 10:31:10 +00:00
sched act_pedit: check binding before calling tcf_hash_release() 2015-08-25 10:13:55 +01:00
sctp sctp: Fix race between OOTB responce and route removal 2015-07-06 10:40:21 +01:00
sunrpc SUNRPC: Fix a memory leak in the backchannel code 2015-07-15 10:00:17 +01:00
tipc tipc: fix message importance range check 2014-10-15 12:05:27 +02:00
unix unix/caif: sk_socket can disappear when state is unlocked 2015-06-12 13:30:18 +01:00
vmw_vsock vsock: Make transport the proto owner 2014-05-05 13:13:50 -04:00
wimax wimax: remove dead code 2013-11-21 13:09:42 -05:00
wireless cfg80211: ignore netif running state when changing iftype 2015-07-15 10:01:22 +01:00
x25 net: Fix use after free by removing length arg from sk_data_ready callbacks. 2014-04-11 16:15:36 -04:00
xfrm xfrm: fix a race in xfrm_state_lookup_byspi 2015-06-11 11:25:00 +01:00
compat.c net: compat: Update get_compat_msghdr() to match copy_msghdr_from_user() behaviour 2015-03-24 10:48:46 +00:00
Kconfig Merge branch 'for-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup 2014-04-03 13:05:42 -07:00
Makefile net: move 6lowpan compression code to separate module 2014-01-15 15:36:38 -08:00
nonet.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
socket.c net: socket: Fix the wrong returns for recvmsg and sendmsg 2015-06-02 11:10:03 +01:00
sysctl_net.c net: Update the sysctl permissions handler to test effective uid/gid 2013-10-07 15:57:56 -04:00