From patchwork Thu Sep 13 13:19:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yifeng Sun X-Patchwork-Id: 969483 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="D7mdpk27"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42B6Qf6HNNz9s4V for ; Fri, 14 Sep 2018 04:20:42 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id DC1A6CA1; Thu, 13 Sep 2018 18:20:38 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 18650C9F for ; Thu, 13 Sep 2018 18:20:38 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id EAC027A6 for ; Thu, 13 Sep 2018 18:20:36 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id f66-v6so2966910plb.10 for ; Thu, 13 Sep 2018 11:20:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=SQD7Yr3FaWfqGRpXnp12gLXQIc6HNZIlx1OCTeDX1CQ=; b=D7mdpk27RKzNAMJEHh0ADzQbVHDr4BZealdIpMqVm7H8TmWqWXtS+KydMj3EsfEd9u StnVri5vBM4hBk+SzMQx7EZKVvVot/0dc1JViC/tGXAAFuDACNYHKBRKhg6tfzE/hfyF 2p64DytlFj/r5O2cwvWQSylHJGLWnUamG/VOMOj+jCFYxmvGzVhmyhgYuCm5dwzVxeUU qK1OZI/gLY8konwOCiWUQAAqpZ8n7yo34xYw+CbtcuJZXWOpxMPJoYOUjHb+ToGooPMb biws2QP9VD4Fd6Q9dSMRNIE2a+Tc9DjzMo76jDfnpbefIQJuaZ/Hc+HEkPYY8+0cj0Ys 3MIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=SQD7Yr3FaWfqGRpXnp12gLXQIc6HNZIlx1OCTeDX1CQ=; b=rjV8vF3iHiP862X4hfApOHswg8u0Scxjkhd3RbfACqWzLslvbUJvvQP41cNuFuPp4m VDYOR5I13HnBuf08SDDJLd4wP+qiEL8Nj6WPlEwJmXnO0SLPNI3cjtqApgJkrZ6R7tUB 431961qvRTZgGi9ueXP+q9v8sKi8XkWWFmbtTt95J8BMeKwovCKRnbUace6klrM6IbxB tiJHwGimdoTi0L2QdBIWdgXSkvddguyyCN8JD8snhjjfI3g7VHIXCiSXN3cQp9CUECWM bksZJbSdZWuvbS3CHR7MhWIVxahxHFI0uWqZ+MT8eVGB7q3jwtAOcg7LSG22Cj4rl4xq e2gg== X-Gm-Message-State: APzg51Arp5JonlZZxyGIAFY8QCM6rjpWpx2NmhQDw1ZFV5qhGwM2jTfZ m0/WKKNYcqGz5DznygEMO3172Eei X-Google-Smtp-Source: ANB0Vdb882H8UjJuM0a2K3H+QwrdyCkkqgF3jDRPdijNT17LlFIwL0TyJ56VYBY/gF+Bg5TmlY+63A== X-Received: by 2002:a17:902:be07:: with SMTP id r7-v6mr8255081pls.275.1536862836211; Thu, 13 Sep 2018 11:20:36 -0700 (PDT) Received: from yfsovs.eng.vmware.com ([66.170.99.2]) by smtp.gmail.com with ESMTPSA id m20-v6sm12000831pfg.61.2018.09.13.11.20.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 13 Sep 2018 11:20:35 -0700 (PDT) From: Yifeng Sun To: dev@openvswitch.org Date: Thu, 13 Sep 2018 06:19:55 -0700 Message-Id: <1536844795-2926-1-git-send-email-pkusunyifeng@gmail.com> X-Mailer: git-send-email 2.7.4 X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00, DATE_IN_PAST_03_06, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] ofp-print: Fix a memory leak reported by fuzz X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org When ofputil_decode_port_stats returns error, it is possible that custom_stats_counters is valid and still need freed. The fuzz report link is https://oss-fuzz.com/testcase?key=5739356233400320 Signed-off-by: Yifeng Sun --- lib/ofp-print.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ofp-print.c b/lib/ofp-print.c index e05a969a82b0..37d7b8b98c55 100644 --- a/lib/ofp-print.c +++ b/lib/ofp-print.c @@ -558,6 +558,7 @@ ofp_print_ofpst_port_reply(struct ds *string, const struct ofp_header *oh, retval = ofputil_decode_port_stats(&ps, &b); if (retval) { + netdev_free_custom_stats_counters(&ps.custom_stats); return retval != EOF ? retval : 0; } ofputil_format_port_stats(string, &ps, port_map);