Skip to content

Commit 6beb683

Browse files
chaudronkuba-moo
authored andcommitted
openvswitch: Fix unsafe attribute parsing in output_userspace()
This patch replaces the manual Netlink attribute iteration in output_userspace() with nla_for_each_nested(), which ensures that only well-formed attributes are processed. Fixes: ccb1352 ("net: Add Open vSwitch kernel components.") Signed-off-by: Eelco Chaudron <[email protected]> Acked-by: Ilya Maximets <[email protected]> Acked-by: Aaron Conole <[email protected]> Link: https://patch.msgid.link/0bd65949df61591d9171c0dc13e42cea8941da10.1746541734.git.echaudro@redhat.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 9540984 commit 6beb683

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

net/openvswitch/actions.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -975,8 +975,7 @@ static int output_userspace(struct datapath *dp, struct sk_buff *skb,
975975
upcall.cmd = OVS_PACKET_CMD_ACTION;
976976
upcall.mru = OVS_CB(skb)->mru;
977977

978-
for (a = nla_data(attr), rem = nla_len(attr); rem > 0;
979-
a = nla_next(a, &rem)) {
978+
nla_for_each_nested(a, attr, rem) {
980979
switch (nla_type(a)) {
981980
case OVS_USERSPACE_ATTR_USERDATA:
982981
upcall.userdata = a;

0 commit comments

Comments
 (0)