diff mbox series

[ovs-dev,2/4] nx-match: Avoid double-free on some error paths.

Message ID 20180824215014.13635-2-blp@ovn.org
State Accepted
Headers show
Series [ovs-dev,1/4] tests: Add regression tests for all the bugs found by oss-fuzz so far. | expand

Commit Message

Ben Pfaff Aug. 24, 2018, 9:50 p.m. UTC
Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9966
Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9968
Fixes: f1eb32b9641c ("ofp-group: Fix memory leak in error cases parsing group requests.")
Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 lib/nx-match.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Yifeng Sun Aug. 27, 2018, 10:57 p.m. UTC | #1
Looks good to me, thanks for the fix.

Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>

On Fri, Aug 24, 2018 at 2:50 PM Ben Pfaff <blp@ovn.org> wrote:

> Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9966
> Reported-at
> <https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9966Reported-at>:
> https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9968
> Fixes: f1eb32b9641c ("ofp-group: Fix memory leak in error cases parsing
> group requests.")
> Signed-off-by: Ben Pfaff <blp@ovn.org>
> ---
>  lib/nx-match.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/lib/nx-match.c b/lib/nx-match.c
> index 3b030833cb2c..8f98032195af 100644
> --- a/lib/nx-match.c
> +++ b/lib/nx-match.c
> @@ -763,6 +763,7 @@ oxm_pull_field_array(const void *fields_data, size_t
> fields_len,
>                          ofperr_to_string(error));
>
>              free(fa->values);
> +            fa->values = NULL;
>              return error;
>          }
>      }
> --
> 2.16.1
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
Ben Pfaff Aug. 30, 2018, 8:56 p.m. UTC | #2
Thanks, applied and backported.

On Mon, Aug 27, 2018 at 03:57:04PM -0700, Yifeng Sun wrote:
> Looks good to me, thanks for the fix.
> 
> Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
> 
> On Fri, Aug 24, 2018 at 2:50 PM Ben Pfaff <blp@ovn.org> wrote:
> 
> > Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9966
> > Reported-at
> > <https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9966Reported-at>:
> > https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9968
> > Fixes: f1eb32b9641c ("ofp-group: Fix memory leak in error cases parsing
> > group requests.")
> > Signed-off-by: Ben Pfaff <blp@ovn.org>
> > ---
> >  lib/nx-match.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/lib/nx-match.c b/lib/nx-match.c
> > index 3b030833cb2c..8f98032195af 100644
> > --- a/lib/nx-match.c
> > +++ b/lib/nx-match.c
> > @@ -763,6 +763,7 @@ oxm_pull_field_array(const void *fields_data, size_t
> > fields_len,
> >                          ofperr_to_string(error));
> >
> >              free(fa->values);
> > +            fa->values = NULL;
> >              return error;
> >          }
> >      }
> > --
> > 2.16.1
> >
> > _______________________________________________
> > dev mailing list
> > dev@openvswitch.org
> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
> >
diff mbox series

Patch

diff --git a/lib/nx-match.c b/lib/nx-match.c
index 3b030833cb2c..8f98032195af 100644
--- a/lib/nx-match.c
+++ b/lib/nx-match.c
@@ -763,6 +763,7 @@  oxm_pull_field_array(const void *fields_data, size_t fields_len,
                         ofperr_to_string(error));
 
             free(fa->values);
+            fa->values = NULL;
             return error;
         }
     }