diff mbox series

[ovs-dev,1/3] datapath: Avoid OOB read when parsing flow nlattrs

Message ID 1548969379-17608-1-git-send-email-gvrose8192@gmail.com
State Accepted
Headers show
Series [ovs-dev,1/3] datapath: Avoid OOB read when parsing flow nlattrs | expand

Commit Message

Gregory Rose Jan. 31, 2019, 9:16 p.m. UTC
From: Ross Lagerwall <ross.lagerwall@citrix.com>

Upstream commit:
    commit 04a4af334b971814eedf4e4a413343ad3287d9a9
    Author: Ross Lagerwall <ross.lagerwall@citrix.com>
    Date:   Mon Jan 14 09:16:56 2019 +0000

    openvswitch: Avoid OOB read when parsing flow nlattrs

    For nested and variable attributes, the expected length of an attribute
    is not known and marked by a negative number.  This results in an OOB
    read when the expected length is later used to check if the attribute is
    all zeros. Fix this by using the actual length of the attribute rather
    than the expected length.

    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Acked-by: Pravin B Shelar <pshelar@ovn.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Cc: Ross Lagerwall <ross.lagerwall@citrix.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
---
 datapath/flow_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Yi-Hung Wei Jan. 31, 2019, 9:37 p.m. UTC | #1
On Thu, Jan 31, 2019 at 1:17 PM Greg Rose <gvrose8192@gmail.com> wrote:
>
> From: Ross Lagerwall <ross.lagerwall@citrix.com>
>
> Upstream commit:
>     commit 04a4af334b971814eedf4e4a413343ad3287d9a9
>     Author: Ross Lagerwall <ross.lagerwall@citrix.com>
>     Date:   Mon Jan 14 09:16:56 2019 +0000
>
>     openvswitch: Avoid OOB read when parsing flow nlattrs
>
>     For nested and variable attributes, the expected length of an attribute
>     is not known and marked by a negative number.  This results in an OOB
>     read when the expected length is later used to check if the attribute is
>     all zeros. Fix this by using the actual length of the attribute rather
>     than the expected length.
>
>     Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
>     Acked-by: Pravin B Shelar <pshelar@ovn.org>
>     Signed-off-by: David S. Miller <davem@davemloft.net>
>
> Cc: Ross Lagerwall <ross.lagerwall@citrix.com>
> Signed-off-by: Greg Rose <gvrose8192@gmail.com>
> ---
Thanks for the backport.  I am good with the whole series.

Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
0-day Robot Jan. 31, 2019, 9:59 p.m. UTC | #2
Bleep bloop.  Greetings Greg Rose, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
ERROR: Author Ross Lagerwall <ross.lagerwall@citrix.com> needs to sign off.
WARNING: Unexpected sign-offs from developers who are not authors or co-authors or committers: Greg Rose <gvrose8192@gmail.com>
Lines checked: 46, Warnings: 1, Errors: 1


Please check this out.  If you feel there has been an error, please email aconole@bytheb.org

Thanks,
0-day Robot
Gregory Rose Feb. 1, 2019, 12:03 a.m. UTC | #3
Hmmm...

I used the accepted (or at least previously accepted) method for 
upstream commits.  Has something changed?

- Greg

On 1/31/2019 1:59 PM, 0-day Robot wrote:
> Bleep bloop.  Greetings Greg Rose, I am a robot and I have tried out your patch.
> Thanks for your contribution.
>
> I encountered some error that I wasn't expecting.  See the details below.
>
>
> checkpatch:
> ERROR: Author Ross Lagerwall <ross.lagerwall@citrix.com> needs to sign off.
> WARNING: Unexpected sign-offs from developers who are not authors or co-authors or committers: Greg Rose <gvrose8192@gmail.com>
> Lines checked: 46, Warnings: 1, Errors: 1
>
>
> Please check this out.  If you feel there has been an error, please email aconole@bytheb.org
>
> Thanks,
> 0-day Robot
Aaron Conole Feb. 1, 2019, 5:59 p.m. UTC | #4
Gregory Rose <gvrose8192@gmail.com> writes:

> Hmmm...
>
> I used the accepted (or at least previously accepted) method for
> upstream commits.  Has something changed?

Nope - the robot usually bleeps about these backports (historically, it
seems to anyway).

I'll try to set aside some time next week and look into it a bit.

> - Greg
>
> On 1/31/2019 1:59 PM, 0-day Robot wrote:
>> Bleep bloop.  Greetings Greg Rose, I am a robot and I have tried out your patch.
>> Thanks for your contribution.
>>
>> I encountered some error that I wasn't expecting.  See the details below.
>>
>>
>> checkpatch:
>> ERROR: Author Ross Lagerwall <ross.lagerwall@citrix.com> needs to sign off.
>> WARNING: Unexpected sign-offs from developers who are not authors or
>> co-authors or committers: Greg Rose <gvrose8192@gmail.com>
>> Lines checked: 46, Warnings: 1, Errors: 1
>>
>>
>> Please check this out.  If you feel there has been an error, please email aconole@bytheb.org
>>
>> Thanks,
>> 0-day Robot
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Gregory Rose Feb. 1, 2019, 6:02 p.m. UTC | #5
On 2/1/2019 9:59 AM, Aaron Conole wrote:
> Gregory Rose <gvrose8192@gmail.com> writes:
>
>> Hmmm...
>>
>> I used the accepted (or at least previously accepted) method for
>> upstream commits.  Has something changed?
> Nope - the robot usually bleeps about these backports (historically, it
> seems to anyway).
>
> I'll try to set aside some time next week and look into it a bit.

Ah, I see.  Well, in the realm of things we need to work on it seems 
lower priority but thanks for the
explanation.  That's good enough for me.

Regards,

- Greg

>
>> - Greg
>>
>> On 1/31/2019 1:59 PM, 0-day Robot wrote:
>>> Bleep bloop.  Greetings Greg Rose, I am a robot and I have tried out your patch.
>>> Thanks for your contribution.
>>>
>>> I encountered some error that I wasn't expecting.  See the details below.
>>>
>>>
>>> checkpatch:
>>> ERROR: Author Ross Lagerwall <ross.lagerwall@citrix.com> needs to sign off.
>>> WARNING: Unexpected sign-offs from developers who are not authors or
>>> co-authors or committers: Greg Rose <gvrose8192@gmail.com>
>>> Lines checked: 46, Warnings: 1, Errors: 1
>>>
>>>
>>> Please check this out.  If you feel there has been an error, please email aconole@bytheb.org
>>>
>>> Thanks,
>>> 0-day Robot
>> _______________________________________________
>> dev mailing list
>> dev@openvswitch.org
>> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Ben Pfaff Feb. 4, 2019, 9:49 p.m. UTC | #6
I applied this series to master and backported as far as branch-2.6.
(It did not apply cleanly to branch-2.5.)
Gregory Rose Feb. 4, 2019, 10:20 p.m. UTC | #7
Thanks Ben!!

On 2/4/2019 1:49 PM, Ben Pfaff wrote:
> I applied this series to master and backported as far as branch-2.6.
> (It did not apply cleanly to branch-2.5.)
diff mbox series

Patch

diff --git a/datapath/flow_netlink.c b/datapath/flow_netlink.c
index 07a6026..e5e469a 100644
--- a/datapath/flow_netlink.c
+++ b/datapath/flow_netlink.c
@@ -502,7 +502,7 @@  static int __parse_flow_nlattrs(const struct nlattr *attr,
 			return -EINVAL;
 		}
 
-		if (!nz || !is_all_zero(nla_data(nla), expected_len)) {
+		if (!nz || !is_all_zero(nla_data(nla), nla_len(nla))) {
 			attrs |= 1ULL << type;
 			a[type] = nla;
 		}