[ovs-dev] [PATCH ovn] ovn-trace: fix core dump with unknown logical port

Dumitru Ceara dceara at redhat.com
Mon Jan 4 13:44:04 UTC 2021


On 12/23/20 5:44 PM, Lorenzo Bianconi wrote:
> Fix ovn-trace core dump with unknown logical port

Hi Lorenzo,

I guess this is a typo (in the subject too).  The crash happens when
using an unknown datapath.

> 
> Fixes: 4735d397a400 ("ovn-trace: New utility")

This should be:

Fixes: aade361c7ebe ("ovn-trace: Make the "datapath" command-line
argument optional.")

> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi at redhat.com>
> ---

I think the real problem is that we don't check the return value of
ovntrace_datapath_find_by_name() properly.  What about this alternate fix?

Also, would it be possible to add a small unit test?

Thanks,
Dumitru

diff --git a/utilities/ovn-trace.c b/utilities/ovn-trace.c index
6fad365..fb66f64 100644
--- a/utilities/ovn-trace.c
+++ b/utilities/ovn-trace.c
@@ -2661,7 +2661,7 @@ trace_parse(const char *dp_s, const char *flow_s,
     if (dp_s) {
         /* Use the specified datapath. */
         *dpp = ovntrace_datapath_find_by_name(dp_s);
-        if (!dpp) {
+        if (!(*dpp)) {
             return xasprintf("unknown datapath \"%s\"\n", dp_s);
         }
     } else {



More information about the dev mailing list