Skip to contentSkip to conversation

openvswitch: potential NULL deref in sample()

PATCH Applied Dan Carpenter 3 participants 3 messages Jul 23, 2012 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 openvswitch: potential NULL deref in sample()

If there is no OVS_SAMPLE_ATTR_ACTIONS set then "acts_list" is NULL and it leads to a NULL dereference when we call nla_len(acts_list). This is a static checker fix, not something I have seen in testing.

---
This applies to Linus's tree.

net/openvswitch/actions.c +3 -0
index 48badff..c2351d6 100644
@@ -325,6 +325,9 @@ static int sample(struct datapath *dp, struct sk_buff *skb,
 		}
 	}
 
+	if (!acts_list)
+		return 0;
+
 	return do_execute_actions(dp, skb, nla_data(acts_list),
 						 nla_len(acts_list), true);
 }
#3 lore raw
In reply to a message not in the archive
Quoted 5 lines · Dan Carpenter

If there is no OVS_SAMPLE_ATTR_ACTIONS set then "acts_list" is NULL and it leads to a NULL dereference when we call nla_len(acts_list). This is a static checker fix, not something I have seen in testing.

This can never happen in practice because the action list is validated at the time that userspace installs the flow. There are plenty of things in this category that would appear to be unsafe because we'd much rather do sanity checking on a per-flow basis rather than per-packet.