[ovs-dev] [PATCH 1/2] ofproto-dpif-upcall: Fix action attr iteration.

Joe Stringer joe at ovn.org
Mon Aug 7 19:45:30 UTC 2017


On 2 August 2017 at 17:11, Greg Rose <gvrose8192 at gmail.com> wrote:
> On 07/31/2017 04:54 PM, Joe Stringer wrote:
>>
>> This calls is operating on messages generated by the datapath. If a
>
>
> s/calls/call
>
>> datapath implementation sends improperly formatted netlink attributes,
>> then it's possible for a revalidator thread to end up trapped in an
>> infinite loop iterating across the actions attributes. Rather than using
>> the UNSAFE variation of this iterator, use the regular version.
>>
>> Fixes: e672ff9b4d22 ("ofproto-dpif: Restore metadata and registers on
>> recirculation.")
>> Signed-off-by: Joe Stringer <joe at ovn.org>
>> ---
>>   ofproto/ofproto-dpif-upcall.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
>> index b2f9d91d2d9c..8d1783accdc8 100644
>> --- a/ofproto/ofproto-dpif-upcall.c
>> +++ b/ofproto/ofproto-dpif-upcall.c
>> @@ -1606,7 +1606,7 @@ ukey_create_from_dpif_flow(const struct udpif
>> *udpif,
>>               return EINVAL;
>>           }
>>       }
>> -    NL_ATTR_FOR_EACH_UNSAFE (a, left, flow->actions, flow->actions_len) {
>> +    NL_ATTR_FOR_EACH (a, left, flow->actions, flow->actions_len) {
>>           if (nl_attr_type(a) == OVS_ACTION_ATTR_RECIRC) {
>>               return EINVAL;
>>           }
>>
> I suppose we have to protect ourselves from malformed messages but I suppose
> there might be some small impact on performance?

Plausibly, but it's a bit hard to tell. I don't think it's big enough
that it outweighs making this code more robust.


More information about the dev mailing list