Skip to content

Commit 483389f

Browse files
committed
rtnetlink: Correct nested IFLA_VF_VLAN_LIST attribute validation
jira LE-1907 cve CVE-2024-36017 Rebuild_History Non-Buildable kernel-4.18.0-553.16.1.el8_10 commit-author Roded Zats <[email protected]> commit 1aec77b 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]> (cherry picked from commit 1aec77b) Signed-off-by: Jonathan Maple <[email protected]>
1 parent 3c5d45c commit 483389f

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
@@ -2364,7 +2364,7 @@ static int do_setvfinfo(struct net_device *dev, struct nlattr **tb)
23642364

23652365
nla_for_each_nested(attr, tb[IFLA_VF_VLAN_LIST], rem) {
23662366
if (nla_type(attr) != IFLA_VF_VLAN_INFO ||
2367-
nla_len(attr) < NLA_HDRLEN) {
2367+
nla_len(attr) < sizeof(struct ifla_vf_vlan_info)) {
23682368
return -EINVAL;
23692369
}
23702370
if (len >= MAX_VLAN_LIST_LEN)

0 commit comments

Comments
 (0)