Skip to content

Commit 1aec77b

Browse files
Roded Zatskuba-moo
authored andcommitted
rtnetlink: Correct nested IFLA_VF_VLAN_LIST attribute validation
Each attribute inside a nested IFLA_VF_VLAN_LIST is assumed to be a struct ifla_vf_vlan_info so the size of such attribute needs to be at least of sizeof(struct ifla_vf_vlan_info) which is 14 bytes. The current size validation in do_setvfinfo is against NLA_HDRLEN (4 bytes) which is less than sizeof(struct ifla_vf_vlan_info) so this validation is not enough and a too small attribute might be cast to a struct ifla_vf_vlan_info, this might result in an out of bands read access when accessing the saved (casted) entry in ivvl. Fixes: 79aab09 ("net: Update API for VF vlan protocol 802.1ad support") Signed-off-by: Roded Zats <[email protected]> Reviewed-by: Donald Hunter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent d0de616 commit 1aec77b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/core/rtnetlink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2530,7 +2530,7 @@ static int do_setvfinfo(struct net_device *dev, struct nlattr **tb)
25302530

25312531
nla_for_each_nested(attr, tb[IFLA_VF_VLAN_LIST], rem) {
25322532
if (nla_type(attr) != IFLA_VF_VLAN_INFO ||
2533-
nla_len(attr) < NLA_HDRLEN) {
2533+
nla_len(attr) < sizeof(struct ifla_vf_vlan_info)) {
25342534
return -EINVAL;
25352535
}
25362536
if (len >= MAX_VLAN_LIST_LEN)

0 commit comments

Comments
 (0)