netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] openvswitch: Avoid OOB read when parsing flow nlattrs
@ 2019-01-14  9:16 Ross Lagerwall
  2019-01-15  0:19 ` Pravin Shelar
  2019-01-16 21:35 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Ross Lagerwall @ 2019-01-14  9:16 UTC (permalink / raw)
  To: netdev; +Cc: Pravin B Shelar, David S. Miller, dev, Ross Lagerwall

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>
---
 net/openvswitch/flow_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index 435a4bdf8f89..691da853bef5 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -500,7 +500,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 |= 1 << type;
 			a[type] = nla;
 		}
-- 
2.17.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] openvswitch: Avoid OOB read when parsing flow nlattrs
  2019-01-14  9:16 [PATCH] openvswitch: Avoid OOB read when parsing flow nlattrs Ross Lagerwall
@ 2019-01-15  0:19 ` Pravin Shelar
  2019-01-16 21:35 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Pravin Shelar @ 2019-01-15  0:19 UTC (permalink / raw)
  To: Ross Lagerwall; +Cc: Linux Kernel Network Developers, David S. Miller, ovs dev

On Mon, Jan 14, 2019 at 1:17 AM Ross Lagerwall
<ross.lagerwall@citrix.com> wrote:
>
> 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>
> ---
>  net/openvswitch/flow_netlink.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
> index 435a4bdf8f89..691da853bef5 100644
> --- a/net/openvswitch/flow_netlink.c
> +++ b/net/openvswitch/flow_netlink.c
> @@ -500,7 +500,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 |= 1 << type;
>                         a[type] = nla;
>                 }

Good Catch.
Acked-by: Pravin B Shelar <pshelar@ovn.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] openvswitch: Avoid OOB read when parsing flow nlattrs
  2019-01-14  9:16 [PATCH] openvswitch: Avoid OOB read when parsing flow nlattrs Ross Lagerwall
  2019-01-15  0:19 ` Pravin Shelar
@ 2019-01-16 21:35 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-01-16 21:35 UTC (permalink / raw)
  To: ross.lagerwall; +Cc: netdev, pshelar, dev

From: Ross Lagerwall <ross.lagerwall@citrix.com>
Date: Mon, 14 Jan 2019 09:16:56 +0000

> 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>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-16 21:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-14  9:16 [PATCH] openvswitch: Avoid OOB read when parsing flow nlattrs Ross Lagerwall
2019-01-15  0:19 ` Pravin Shelar
2019-01-16 21:35 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).