From patchwork Wed Sep 11 21:18:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yifeng Sun X-Patchwork-Id: 1161289 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="A42LaF8v"; 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 46TFBd3xnyz9s00 for ; Thu, 12 Sep 2019 07:18:49 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 6E02FCDF; Wed, 11 Sep 2019 21:18:45 +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 C9918B1F for ; Wed, 11 Sep 2019 21:18:43 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 79B7082B for ; Wed, 11 Sep 2019 21:18:43 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id h195so14506801pfe.5 for ; Wed, 11 Sep 2019 14:18:43 -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=cyGed1GpR1lGn2O+pXOYbh1z4SqR9rffE9jLOJ4Xn5A=; b=A42LaF8vdQ63biTNUf12ZSS3XWQa/Yxdq7dq0exLY3UzOXLhUE4DtkImtAMaARjPJn jTjlJg+wXK6iMqCtVyNs5WteWDc84svkFjBpZC87op/roqWOcp0WFw2JtSJv7rA/cTJx FgYmrQYCSmGQCyvfD7R1j8gLdayGsqF5o+lMRidTgF3WJsjoH7JTsIWZ9XmiXCS4EFOf 76/SkQPia2JlPZnuMZaFg/ftXzaOrZlROdVyvaI3uABNqtKJ/SWT0AbUgN47N49k9Y0f 0oWm/WyJU7H5Etog6of9Ao+acIzjU8y5Nl4T9hsGU5vEaMg6zA8QgZOLMKvzZFlLTlos sIaQ== 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=cyGed1GpR1lGn2O+pXOYbh1z4SqR9rffE9jLOJ4Xn5A=; b=anuDmQjaMESa7VCivnREDLen4nnuMlLv2FGSlGzXDMWEGscWMfa91unHp5LR1BRvy6 tXk9udctnqnEKB65WkW892xqkGKeV/rdv6i7tU6Gl+L3I0zl1HnkR04448V8cRTu1Zvb opDWJl0aKv6vL1NgfgFGSu14shbN8MgVvo+xOOlkn3/W2AQaHekxlP427o24VC2tGsHE NNB/RfbBk2BNrSpuS22/vz55Z9xhfA8bZGrVyTaI2y845/BwqTcG5meqsiWEg04rzMkz 2Eqc9tn6cxger9Ua2tDYfyP3Z1L0K3DzAQM/4A0jbpEX9sxKQwS6hcOysQWloyGIml1X m02w== X-Gm-Message-State: APjAAAW8VkhN4dACituDMPaQuhMDZo7yQv+jdiuGbGaE23JyhX1AE4Ac v+ADzgyaZyj6uf4p3PQwzOt1FIJb X-Google-Smtp-Source: APXvYqwpuwNqrVvorqVRomXKca//A+b/HU0fdr+/rhhs0ZQQfhHQFvywSisGhCCBPjhxrAW+CoTr0Q== X-Received: by 2002:a17:90a:e98e:: with SMTP id v14mr7974306pjy.101.1568236722299; Wed, 11 Sep 2019 14:18:42 -0700 (PDT) Received: from kern417.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id k1sm24612487pfi.132.2019.09.11.14.18.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Sep 2019 14:18:41 -0700 (PDT) From: Yifeng Sun To: dev@openvswitch.org Date: Wed, 11 Sep 2019 14:18:27 -0700 Message-Id: <1568236716-18105-1-git-send-email-pkusunyifeng@gmail.com> X-Mailer: git-send-email 2.7.4 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 01/10] raft: Free leaked json data 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 Valgrind reported: 1924: compacting online - cluster ==29312== 2,886 (240 direct, 2,646 indirect) bytes in 6 blocks are definitely lost in loss record 406 of 413 ==29312== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==29312== by 0x44A5F4: xmalloc (util.c:138) ==29312== by 0x4308EA: json_create (json.c:1451) ==29312== by 0x4308EA: json_object_create (json.c:254) ==29312== by 0x430ED0: json_parser_push_object (json.c:1273) ==29312== by 0x430ED0: json_parser_input (json.c:1371) ==29312== by 0x431CF1: json_lex_input (json.c:991) ==29312== by 0x43233B: json_parser_feed (json.c:1149) ==29312== by 0x41D87F: parse_body.isra.0 (log.c:411) ==29312== by 0x41E141: ovsdb_log_read (log.c:476) ==29312== by 0x42646D: raft_read_log (raft.c:866) ==29312== by 0x42646D: raft_open (raft.c:951) ==29312== by 0x4151AF: ovsdb_storage_open__ (storage.c:81) ==29312== by 0x408FFC: open_db (ovsdb-server.c:642) ==29312== by 0x40657F: main (ovsdb-server.c:358) This patch fixes it. Signed-off-by: Yifeng Sun Acked-by: William Tu --- ovsdb/raft.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ovsdb/raft.c b/ovsdb/raft.c index 9eabe2cfeecd..a45c7f8ba998 100644 --- a/ovsdb/raft.c +++ b/ovsdb/raft.c @@ -883,6 +883,7 @@ raft_read_log(struct raft *raft) error = raft_apply_record(raft, i, &r); raft_record_uninit(&r); } + json_destroy(json); if (error) { return ovsdb_wrap_error(error, "error reading record %llu from " "%s log", i, raft->name); From patchwork Wed Sep 11 21:18:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yifeng Sun X-Patchwork-Id: 1161290 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="TsbNt31t"; 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 46TFC944rPz9sDB for ; Thu, 12 Sep 2019 07:19:17 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 2D220D4A; Wed, 11 Sep 2019 21:18:46 +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 E6925B79 for ; Wed, 11 Sep 2019 21:18:43 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 9B07E894 for ; Wed, 11 Sep 2019 21:18:43 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id x15so12166956pgg.8 for ; Wed, 11 Sep 2019 14:18:43 -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:in-reply-to:references; bh=/zBlLO7g6z771qLOZG275SNGw40lB8M1fzcUuLzy65M=; b=TsbNt31tBDV+MOPj1hDVEfLcML3mFEeSXMbnoLBlDUL8vSGuSvZsmnPN0SjwBoM/IQ rHKYbu/pHDG3lR+aEwihijOK1iFe6b2grLrRp71bFukFcIG1RGcu26k2ECwEAN64xGCp xuVxMHqL+gfeZvIqD/xuu4phRzPjzv+ZpsbH4PUQ6Epy6k+FO32aGSMi1DyVChnVKSVP X4R8mIvRjnsUDHdxE84Fff+J8RshQ/hbswRHB8ZPFSF/SbomwXybjykCJNqu9j3gQTin oqLEYczkulkjzOFb2zPgOg0hEisx9bDmsgiputDgoxZ2YVIMyYjqDX8orqCPM3EE5Atp /uOw== 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:in-reply-to :references; bh=/zBlLO7g6z771qLOZG275SNGw40lB8M1fzcUuLzy65M=; b=h1+/+qgOWy7SUGAx5Pi+pK2k4f5LlFZlNWGvhxhT3CTLlFO0iB/oJXpd7PhbB70Ms8 +hEDVXr7ZuQDeqOaAoM3qcfKFrh7Y4dJ+2YKP9a8bBMLncLU0iH0nhK1hZ/Z9vgGRgxX xFlxuNM0Xc2/cHZMh7XKvojEQV70GKMN2M7VNs6rG3JBjHIgoDSIHBkucSbA1rmBfhae 9W1dUzx8cZ4OW3ihn1wpRf58MH0vKZhWfKyLkyYGuc627lLmC2r6zjVaAzHbHnVh9DR1 d6vYJyfgZBtFh4vD621ZHrdjT5dpATLCXXxSlZDVPQKNCOwgJoUpIKSC31h63ixAfIpL cx/A== X-Gm-Message-State: APjAAAV3PXDJmyEr3A6EgbJhC3yc3taeQgwu36CTatq6NwFjAVgw/ZRX AsHELhAORQrksARW3PVTSjr6D0ww X-Google-Smtp-Source: APXvYqyREL3M+0gcRggR9YMQGN1uSdW2sVKyE2mm8QzrhtDiATSxRq21ol1pqWpE1S4EkKeaEh3XUQ== X-Received: by 2002:a63:ff0c:: with SMTP id k12mr33380572pgi.186.1568236722887; Wed, 11 Sep 2019 14:18:42 -0700 (PDT) Received: from kern417.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id k1sm24612487pfi.132.2019.09.11.14.18.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Sep 2019 14:18:42 -0700 (PDT) From: Yifeng Sun To: dev@openvswitch.org Date: Wed, 11 Sep 2019 14:18:28 -0700 Message-Id: <1568236716-18105-2-git-send-email-pkusunyifeng@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1568236716-18105-1-git-send-email-pkusunyifeng@gmail.com> References: <1568236716-18105-1-git-send-email-pkusunyifeng@gmail.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 02/10] ofproto-dpif: Uninitialize 'xlate_cache' to free resources 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 Valgrind reported: 1210: ofproto-dpif - continuation after clone ==32205== 4,392 (1,440 direct, 2,952 indirect) bytes in 12 blocks are definitely lost in loss record 359 of 362 ==32205== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==32205== by 0x532574: xmalloc (util.c:138) ==32205== by 0x4F98CA: ofpbuf_init (ofpbuf.c:123) ==32205== by 0x42C07B: nxt_resume (ofproto-dpif.c:5110) ==32205== by 0x41796F: handle_nxt_resume (ofproto.c:3677) ==32205== by 0x424583: handle_single_part_openflow (ofproto.c:8473) ==32205== by 0x424583: handle_openflow (ofproto.c:8606) ==32205== by 0x4579E2: ofconn_run (connmgr.c:1318) ==32205== by 0x4579E2: connmgr_run (connmgr.c:355) ==32205== by 0x41E0F5: ofproto_run (ofproto.c:1845) ==32205== by 0x40BA63: bridge_run__ (bridge.c:2971) ==32205== by 0x410CF3: bridge_run (bridge.c:3029) ==32205== by 0x407614: main (ovs-vswitchd.c:127) This is because 'xcache' was not destroyed properly. This patch fixes it. Signed-off-by: Yifeng Sun Acked-by: William Tu --- ofproto/ofproto-dpif.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 751535249e21..46fa1357163b 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -5148,6 +5148,7 @@ nxt_resume(struct ofproto *ofproto_, /* Clean up. */ ofpbuf_uninit(&odp_actions); dp_packet_uninit(&packet); + xlate_cache_uninit(&xcache); return error; } From patchwork Wed Sep 11 21:18:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yifeng Sun X-Patchwork-Id: 1161291 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="Fq4Vt9nd"; 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 46TFCp3LRBz9s00 for ; Thu, 12 Sep 2019 07:19:50 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id E6BD3D7A; Wed, 11 Sep 2019 21:18:46 +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 C3D38B79 for ; Wed, 11 Sep 2019 21:18:44 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 7777982B for ; Wed, 11 Sep 2019 21:18:44 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id y72so14463774pfb.12 for ; Wed, 11 Sep 2019 14:18:44 -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:in-reply-to:references; bh=wdNX1Kb5JanR6M5zQcpP4INIWHoHyvMSOfZE8oAxwv8=; b=Fq4Vt9nd/T2UzJSzCYJ6J7VttA2LoAHmZmPiW+DUeHEJQEB+sJMc48HcLkruDmGNFU TeVfNlDCUTm7JlMAQPkmN5AUKPmPtx2C7gqHb+yJbgEl0eKh4JND/3KSIzirvtElYIx7 jOmTo5CNf5XGNvbD4BVLnxK47YSWYP51K+/vkTihtHxYJtKh2x93SDWnXksLmzm5/s4a K9nyQGMzdHtRMx3xWIIicanqq8e2JS7Vte6o7z1B6ujRGNZXmE8iF+64dJ1IEG56tpvB xcz4795ueHXuttEua7xWWnvtc+xSWBU8uChWnxqavIUWgZAA8flL++nwm/d/B0cx+/Tw mdMw== 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:in-reply-to :references; bh=wdNX1Kb5JanR6M5zQcpP4INIWHoHyvMSOfZE8oAxwv8=; b=P+X+PcEPPaIkp4KgjFekgul7KOS3fYEdH7Nal+StH8Jh8WZSY1FG5ja++MjhSelvCA QROo76j6M/ArLHMqC4x7WVxk0dzGODeLTdREoHFuGrB7U6dWaly8rK/3+7IyD6qmKPv5 bH7XgA5TnYSvuBVhxKd2qWamPrpoQwcFtcPCB5ZVbrUAkNdf/i1bHsZ+N3gvqUzqhQkP Hq+MHd97DfqCI+2YaXty0i+eSz2J2h9UDwbuyA6KcgX6bJQzM0gflplZJAcWe/4kfErb rFrJjwxCdhA6VW4Wjqw7GiP3/mjLecLimPQQjyQ5cNinaO9v31EHhZ61V2Ni4FYPD3SP uV9w== X-Gm-Message-State: APjAAAXA1JwJKiCco3hBmQGbL5uwP+Fou7A5y3uxdZiVGUPJ3hjgnK7j eX9udRBZLlNGDhZ8KfVxVJWY/tTK X-Google-Smtp-Source: APXvYqy17Jwl0F5ZIJLD45PyMWYnIwG7JVFYUMlC2DWONzOwrnENYiedqpcLHmdUhZtH6VpfIJDULg== X-Received: by 2002:a17:90a:de0f:: with SMTP id m15mr7921609pjv.107.1568236723650; Wed, 11 Sep 2019 14:18:43 -0700 (PDT) Received: from kern417.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id k1sm24612487pfi.132.2019.09.11.14.18.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Sep 2019 14:18:43 -0700 (PDT) From: Yifeng Sun To: dev@openvswitch.org Date: Wed, 11 Sep 2019 14:18:29 -0700 Message-Id: <1568236716-18105-3-git-send-email-pkusunyifeng@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1568236716-18105-1-git-send-email-pkusunyifeng@gmail.com> References: <1568236716-18105-1-git-send-email-pkusunyifeng@gmail.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 03/10] dpif-netdev: Handle uninitialized value error for 'match.wc' 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 Valgrind reported that match.wc was not initialized, as below: 1176: ofproto-dpif - fragment handling - actions ==21214== Conditional jump or move depends on uninitialised value(s) ==21214== at 0x4B77C1: odp_flow_key_from_flow__ (odp-util.c:6143) ==21214== by 0x46DB58: dp_netdev_upcall (dpif-netdev.c:6239) ==21214== by 0x4774A7: handle_packet_upcall (dpif-netdev.c:6608) ==21214== by 0x4774A7: fast_path_processing (dpif-netdev.c:6726) ==21214== by 0x47933C: dp_netdev_input__ (dpif-netdev.c:6814) ==21214== by 0x479AB8: dp_netdev_input (dpif-netdev.c:6852) ==21214== by 0x479AB8: dp_netdev_process_rxq_port (dpif-netdev.c:4287) ==21214== by 0x47A6A9: dpif_netdev_run (dpif-netdev.c:5264) ==21214== by 0x4324E7: type_run (ofproto-dpif.c:342) ==21214== by 0x41C5FE: ofproto_type_run (ofproto.c:1734) ==21214== by 0x40BAAC: bridge_run__ (bridge.c:2965) ==21214== by 0x410CF3: bridge_run (bridge.c:3029) ==21214== by 0x407614: main (ovs-vswitchd.c:127) ==21214== Uninitialised value was created by a stack allocation ==21214== at 0x4769C3: fast_path_processing (dpif-netdev.c:6672) 'match' is allocated on stack but its 'wc' is accessed in odp_flow_key_from_flow__ without proper initialization. This patch fixes it. Signed-off-by: Yifeng Sun Acked-by: William Tu --- lib/dpif-netdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index a88a78f8a688..6be6e47ed127 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -6600,6 +6600,7 @@ handle_packet_upcall(struct dp_netdev_pmd_thread *pmd, match.tun_md.valid = false; miniflow_expand(&key->mf, &match.flow); + memset(&match.wc, 0, sizeof match.wc); ofpbuf_clear(actions); ofpbuf_clear(put_actions); From patchwork Wed Sep 11 21:18:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yifeng Sun X-Patchwork-Id: 1161292 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="WoXWU2Cu"; 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 46TFDV0hHWz9s00 for ; Thu, 12 Sep 2019 07:20:26 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 977E3CD1; Wed, 11 Sep 2019 21:18:47 +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 3235FB1F for ; Wed, 11 Sep 2019 21:18:45 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id DDACE82B for ; Wed, 11 Sep 2019 21:18:44 +0000 (UTC) Received: by mail-pg1-f182.google.com with SMTP id j191so1631616pgd.3 for ; Wed, 11 Sep 2019 14:18:44 -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:in-reply-to:references; bh=Mbu4Nt40j427Y7/KoYfd1WRO74CdP/my9Zl9kQJZ6zo=; b=WoXWU2CuFePRDUVYeo9F0CsYFFMGGAkaTnBF5Lsjpz9JlqJZ9OAMn/Z8/4fkxW4Sha PVrSjKxnuKATLF44kf5FlsbWHFegU/D/P2q6JPlilGTjlxYOBUXkAAp+uMjXcJWgmSlj O5o66K+ulwDzdJsF3Kp+6zPmzrNkurxCcMfqnqz+S7dMITE4QZw2VhkwT8GvIZHbqDsD rHR+TYmy8xBnKn2NR8RA/cXOMSiCQg/S7jUzZyAaRVv/SnXSRYDw7crxtlbdJICYudz+ LQZaAD1bqhc5AHJjCrBc+qUGORgDB3FbMphBB8kr36f+UnmTB6P0iUckmpxqtrJhmdGJ hetQ== 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:in-reply-to :references; bh=Mbu4Nt40j427Y7/KoYfd1WRO74CdP/my9Zl9kQJZ6zo=; b=Ig/C6sD2YG2qhJwhvOqBbTBosb20AZYpKMRdJcrwMyfEKssWRNMmdMvMBFMe7V/TYl UGveHuILrsJEzvw3XzxkCvDq2a7/hxYwMzWOE+q3RaVUzy13Wr6JT9eSQ6MJQcBvxF6u w3co1Hc53StOGA/6uUtvl3PuDIyLynn7W+DaMi6H7oyD0QcVGrL3tJRy/hUdKNoyYayW dY4biO5tPqyAa+UCy/mlzZ05M27snXtM5TiAgCtE+nbGdadFAjCajiAFzTduAhz9pTlN Cr1PJjXsuuRN2kbXd+BTw4jx4LARgPsWFsmb7u4qLsoU3KNYtqafBGk0gwPAWDqsPV3k zJ8A== X-Gm-Message-State: APjAAAV/4ixmoZVivDINz7Z0p4ji1Oo8xHn0n/MVLyhNXMwsbwAi75gG TRrogKrLYFghCj1F5HRGfUAObWGr X-Google-Smtp-Source: APXvYqzH1XGH/O1Fg397NeEq2TLLxVPGZ5nUAjdXixtXzeHR/qIMNEWuiUTGlYU2NNggvAaZ322tsA== X-Received: by 2002:a62:1b85:: with SMTP id b127mr36296933pfb.56.1568236724268; Wed, 11 Sep 2019 14:18:44 -0700 (PDT) Received: from kern417.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id k1sm24612487pfi.132.2019.09.11.14.18.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Sep 2019 14:18:43 -0700 (PDT) From: Yifeng Sun To: dev@openvswitch.org Date: Wed, 11 Sep 2019 14:18:30 -0700 Message-Id: <1568236716-18105-4-git-send-email-pkusunyifeng@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1568236716-18105-1-git-send-email-pkusunyifeng@gmail.com> References: <1568236716-18105-1-git-send-email-pkusunyifeng@gmail.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 04/10] ovs-ofctl: Free leaked minimatch 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 Valgrind reported: 1056: ofproto - bundle with multiple flow mods (OpenFlow 1.4) ==19220== 160 bytes in 2 blocks are definitely lost in loss record 24 of 34 ==19220== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==19220== by 0x4979A4: xmalloc (util.c:138) ==19220== by 0x42407D: miniflow_alloc (flow.c:3340) ==19220== by 0x4296CF: minimatch_init (match.c:1758) ==19220== by 0x46273D: parse_ofp_str__ (ofp-flow.c:1759) ==19220== by 0x465B9E: parse_ofp_str (ofp-flow.c:1790) ==19220== by 0x465CE0: parse_ofp_flow_mod_str (ofp-flow.c:1817) ==19220== by 0x465DF6: parse_ofp_flow_mod_file (ofp-flow.c:1876) ==19220== by 0x410BA3: ofctl_flow_mod_file.isra.19 (ovs-ofctl.c:1773) ==19220== by 0x417933: ovs_cmdl_run_command__ (command-line.c:223) ==19220== by 0x406F68: main (ovs-ofctl.c:179) This patch fixes it. Signed-off-by: Yifeng Sun Acked-by: William Tu --- utilities/ovs-ofctl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index 754629d3dfbb..06289d296573 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -1724,6 +1724,7 @@ bundle_flow_mod__(const char *remote, struct ofputil_flow_mod *fms, ovs_list_push_back(&requests, &request->list_node); free(CONST_CAST(struct ofpact *, fm->ofpacts)); + minimatch_destroy(&fm->match); } bundle_transact(vconn, &requests, OFPBF_ORDERED | OFPBF_ATOMIC); From patchwork Wed Sep 11 21:18:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yifeng Sun X-Patchwork-Id: 1161293 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="O/Qfqrsh"; 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 46TFF41rsHz9s00 for ; Thu, 12 Sep 2019 07:20:56 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 4BACCD98; Wed, 11 Sep 2019 21:18:48 +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 2AEDDD49 for ; Wed, 11 Sep 2019 21:18:46 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id D751182B for ; Wed, 11 Sep 2019 21:18:45 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id y22so14526694pfr.3 for ; Wed, 11 Sep 2019 14:18:45 -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:in-reply-to:references; bh=/pPj7xgen2zIZFJjjs6nUCsOGsBFIbqKsgDv2TYNIlM=; b=O/QfqrshyZt17K5JcoGkQmLyDSD0fwxg1Njjjh7KdWp5VovDHOJjREJFS04P90tB3D mzQmxcJz9OOn4ZQ5Ec1h9/9bBSRQ22BvPoS3D5YAxLXp9aUPzYSK/V0i0Gq7t1LEZllg C44FCszjpHXYEB/130UtpON/wAKsA8hU7JsYCAXfUSE7ejCdWNH7R8NhW8T6aLz5Xz01 uwPiYPBpMpRflKTYHGW6+PPZBgIphp4JmXgnsWwD9cdz+YAB3vaHxF0NKz5HmDqy4pRi 50CXW6AX9DNmzNR/X5DkJJVejpVyRUeb8Jb9MEp8UpPMdSBr3k0fXvODZEDb7zlGPmEP fQiA== 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:in-reply-to :references; bh=/pPj7xgen2zIZFJjjs6nUCsOGsBFIbqKsgDv2TYNIlM=; b=a8MEOv+o8w9fQ3sVxKYan9i/+mGMVqCKp3bFx1WaVUttdIjqiULrwgjWNLP64eV/TB e5DYcfvOBtJdLpLeaBqI7TsTvhaIjIhJho2NasC/7v6NZbw4VDLM1mZ3nLSnR5PhB83y ajQWWb8TCcBt/LDOmgW53OJ4xq8GfoNVzDk24Rrg/O5CXaz7NRScIQHoAon45sHViZVD jrfaJEIYDFvOQfrlsbZaznLxV2OoQ7eCWDGymnwG4gsq63J4Nn3rXsbJz8d7n3xmcb4N mlzot2O1S5FEhSQBfYCUlxpqf8hBTIVyarD98fWodMvKpv1TIplEADFtW3OzDJaZvGpa BoqA== X-Gm-Message-State: APjAAAUgENpL6RGd8IojJk9RZbZPN7TRaxLMxiPFgXWt+Uxo8zmCtHwu T9CACDyaR0dZkN0hsyv6VWsyQWLZ X-Google-Smtp-Source: APXvYqxEuPZfOULAlWO+kni22ti7Fk9mTDNKQzOMEt/UcWkP6G5H/2SfZZwWAlvHTiQl1T8AyV3DfQ== X-Received: by 2002:a63:3c46:: with SMTP id i6mr8190887pgn.18.1568236725011; Wed, 11 Sep 2019 14:18:45 -0700 (PDT) Received: from kern417.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id k1sm24612487pfi.132.2019.09.11.14.18.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Sep 2019 14:18:44 -0700 (PDT) From: Yifeng Sun To: dev@openvswitch.org Date: Wed, 11 Sep 2019 14:18:31 -0700 Message-Id: <1568236716-18105-5-git-send-email-pkusunyifeng@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1568236716-18105-1-git-send-email-pkusunyifeng@gmail.com> References: <1568236716-18105-1-git-send-email-pkusunyifeng@gmail.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 05/10] trigger: Free leaked ovsdb_schema 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 Valgrind reported: 1925: schema conversion online - standalone ==10884== 689 (56 direct, 633 indirect) bytes in 1 blocks are definitely lost in loss record 384 of 420 ==10884== at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10884== by 0x44A592: xcalloc (util.c:121) ==10884== by 0x40E2EC: ovsdb_schema_create (ovsdb.c:41) ==10884== by 0x40E688: ovsdb_schema_from_json (ovsdb.c:217) ==10884== by 0x416C6F: ovsdb_trigger_try (trigger.c:246) ==10884== by 0x40D4DE: ovsdb_jsonrpc_trigger_create (jsonrpc-server.c:1119) ==10884== by 0x40D4DE: ovsdb_jsonrpc_session_got_request (jsonrpc-server.c:986) ==10884== by 0x40D4DE: ovsdb_jsonrpc_session_run (jsonrpc-server.c:556) ==10884== by 0x40D4DE: ovsdb_jsonrpc_session_run_all (jsonrpc-server.c:586) ==10884== by 0x40D4DE: ovsdb_jsonrpc_server_run (jsonrpc-server.c:401) ==10884== by 0x406A6E: main_loop (ovsdb-server.c:209) ==10884== by 0x406A6E: main (ovsdb-server.c:460) 'new_schema' should also be freed when there is no error. This patch fixes it. Signed-off-by: Yifeng Sun Acked-by: Aliasgar Ginwala Acked-by: William Tu --- ovsdb/trigger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ovsdb/trigger.c b/ovsdb/trigger.c index 6f4ed96b000b..7e62e90ae381 100644 --- a/ovsdb/trigger.c +++ b/ovsdb/trigger.c @@ -254,8 +254,8 @@ ovsdb_trigger_try(struct ovsdb_trigger *t, long long int now) if (!error) { error = ovsdb_convert(t->db, new_schema, &newdb); } + ovsdb_schema_destroy(new_schema); if (error) { - ovsdb_schema_destroy(new_schema); trigger_convert_error(t, error); return false; } From patchwork Wed Sep 11 21:18:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yifeng Sun X-Patchwork-Id: 1161294 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="IrU96SZE"; 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 46TFFZ45Dmz9s00 for ; Thu, 12 Sep 2019 07:21:22 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id ED78BDB9; Wed, 11 Sep 2019 21:18:48 +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 8DCEDD67 for ; Wed, 11 Sep 2019 21:18:46 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 4E70582B for ; Wed, 11 Sep 2019 21:18:46 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id y22so14526709pfr.3 for ; Wed, 11 Sep 2019 14:18:46 -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:in-reply-to:references; bh=Vdxh/9GZ1N6HSceqO6oKJ8TlXpb4R3A18bLTaBD/D7c=; b=IrU96SZEbcGmAzpObXr55E8XFdAkZmH6NTWr3YiGiORr96ZJoyye8r47+4I5hvfXRg mJrszGJFpcDbvkjXQPrGdcXpPa0EGDIOLrUJv5+RwVhWt/SMM9mIzy5W0Tl6weZRQYRj gZ3QyUMMi4hfdG7pN/B1iDYWcPD6PFmwaqYhDnixTQkHpJQXWJqaKWK0gGdnYpTyJ0dR OHGRAOcHFd1IJxeYIRHWZ6He3XZVfS7kM7zT94RfJqCNpt5gLtOAP0usW5iKiDkRGVmH /ei1wkueW8dudgV8ILGE6UyBw8vfHcF9CcUJU4R5mbPWCwH6tmfYNsVn1i58VeI6XNMu ICsg== 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:in-reply-to :references; bh=Vdxh/9GZ1N6HSceqO6oKJ8TlXpb4R3A18bLTaBD/D7c=; b=LHXBlTXq3v9geMeRzDU6XQj/bXwoxGVwTL2FmHfuUjFQqlFiv24TvTIhDNZzo7ym14 r/O60NgyH22fwdPQhi8GCwjt18Xm7dll6pV5oJahTVnG4fgqycR2T4Lpcuf/X7qOfYa6 4IWkaT39LyAkWWshZOXTgYD7j9iTpVOe8I7/K3OEsy2eAv7DaJpzFuy9mL9OUjLf8Des OKqDwyRDgrMZsiBARB2LKKiq2HrFWSN9MD9TYu+RncdOOBf9X9pYmCUEVC9fPXVcZwWd KdHQmuRCvrZqm+V0wYSzFMRRHeQ4rMijgJ2J1Lf0jan3wkLNwF7hASB41MO1y6L5Gcjv O+Fw== X-Gm-Message-State: APjAAAV6stIasJrcJIJKav9JIAH3c2iHHKBW8Bp5ctTfDSq+RaekR9sO MthQZGkJRW07CU4TF1ea/1iHup8I X-Google-Smtp-Source: APXvYqwHdhJAC+JWMWQJQwnEJLHVMAoO3KCy/wcFfz3w0uxvBTYyvYTMdIWJhYqD6CEF+OEJzhrKDw== X-Received: by 2002:a62:754a:: with SMTP id q71mr45097121pfc.70.1568236725663; Wed, 11 Sep 2019 14:18:45 -0700 (PDT) Received: from kern417.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id k1sm24612487pfi.132.2019.09.11.14.18.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Sep 2019 14:18:45 -0700 (PDT) From: Yifeng Sun To: dev@openvswitch.org Date: Wed, 11 Sep 2019 14:18:32 -0700 Message-Id: <1568236716-18105-6-git-send-email-pkusunyifeng@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1568236716-18105-1-git-send-email-pkusunyifeng@gmail.com> References: <1568236716-18105-1-git-send-email-pkusunyifeng@gmail.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 06/10] ovsdb-client: Free ovsdb_schema 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 Valgrind reported: 1925: schema conversion online - standalone ==10727== 689 (56 direct, 633 indirect) bytes in 1 blocks are definitely lost in loss record 64 of 66 ==10727== at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10727== by 0x449D42: xcalloc (util.c:121) ==10727== by 0x40F45C: ovsdb_schema_create (ovsdb.c:41) ==10727== by 0x40F7F8: ovsdb_schema_from_json (ovsdb.c:217) ==10727== by 0x40FB4E: ovsdb_schema_from_file (ovsdb.c:101) ==10727== by 0x40B156: do_convert (ovsdb-client.c:1639) ==10727== by 0x4061C6: main (ovsdb-client.c:282) This patch fixes it. Signed-off-by: Yifeng Sun Acked-by: William Tu --- ovsdb/ovsdb-client.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c index 9ae15e557661..bfc90e6f7f85 100644 --- a/ovsdb/ovsdb-client.c +++ b/ovsdb/ovsdb-client.c @@ -1654,6 +1654,7 @@ do_convert(struct jsonrpc *rpc, const char *database_ OVS_UNUSED, ovsdb_schema_to_json(new_schema)), NULL); check_txn(jsonrpc_transact_block(rpc, request, &reply), &reply); jsonrpc_msg_destroy(reply); + ovsdb_schema_destroy(new_schema); } static void From patchwork Wed Sep 11 21:18:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yifeng Sun X-Patchwork-Id: 1161295 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="e0Rq30IE"; 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 46TFG42wSVz9s00 for ; Thu, 12 Sep 2019 07:21:48 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 92F7BDD0; Wed, 11 Sep 2019 21:18:49 +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 A0623D91 for ; Wed, 11 Sep 2019 21:18:47 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 4359C81A for ; Wed, 11 Sep 2019 21:18:47 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id q10so14509813pfl.0 for ; Wed, 11 Sep 2019 14:18:47 -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:in-reply-to:references; bh=lPt2q0GQ48wgw24KsCPWQya+BNreKTqyqMqGV8UGzH4=; b=e0Rq30IEbeVjMOxS/mOEPN5uq7LSiHXYwfArHJ+J4VJAN0o7ak7vOm6+3vjq7+npn4 ttxXaAhWTIqFOhg9hV7GJ1hmZKaSJ5suF+T7lovf0/OOLN0UtLfwrVLsb53kIb2u06Ul 3iX2po2T1d0+2+wx0/LIVlh/5JbTrIDXXdRHNden2g0CFUM7QkQxnV57Uux87UJ015xb zivBwAq9WTf4UYAYriEHK1iiskmgyzVrOEBb0+Nu+DTCRGjldiP9HQLH71W361L681pM Fne/faqmx8pE4bu6/zFn3TmJPoCJIoTcAeU8LIwty5tLni3PTXOWHgz5vZO+CJmx8r7D QSfA== 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:in-reply-to :references; bh=lPt2q0GQ48wgw24KsCPWQya+BNreKTqyqMqGV8UGzH4=; b=M9TRs5o3OV6InUsd233FwF8BwBPBai6WHDP12epJ9+/79zSPIxudtXIoLT/+n9gJkJ vIFZwxLCAswBXWowvHwiRB0jfmqcpuaqut1+GUb5qXK4nbp3lvq13j9FR6QMBcarLdVe wKqF2I9P3Wd9yNi/Tkzmu9CmFnvipUqG547zS9t+ZhdZCcoSOAn0HkIOzdZU394YXROK zoAfMSWjtsd8OAW3XxWVAvgG4hT84ctuwtYQulAzOTIejsvghorQnQZCgIMneB32Z9Sd PjBfkI+w5DRBjtqUKeOiEN7tLCC15aRVYw4F+kDJplsDk27qZM9R9shLi3jqNzlMJoDk Biuw== X-Gm-Message-State: APjAAAUkizAT544Jc7Kl00JVXj20Ccdovv3Ihl0RY5poXl2hVv976go2 Xp8lkNCWNAhdgWJIeX4/Q1ri3z3i X-Google-Smtp-Source: APXvYqwLc2jMYK5Vpzi1a7VnNxsQXZIrp/F0D1mypk8hEK7ZmmAjsEewtyFvLoeb9Q+VHakQSLcH1w== X-Received: by 2002:a17:90a:a002:: with SMTP id q2mr7617758pjp.69.1568236726386; Wed, 11 Sep 2019 14:18:46 -0700 (PDT) Received: from kern417.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id k1sm24612487pfi.132.2019.09.11.14.18.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Sep 2019 14:18:45 -0700 (PDT) From: Yifeng Sun To: dev@openvswitch.org Date: Wed, 11 Sep 2019 14:18:33 -0700 Message-Id: <1568236716-18105-7-git-send-email-pkusunyifeng@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1568236716-18105-1-git-send-email-pkusunyifeng@gmail.com> References: <1568236716-18105-1-git-send-email-pkusunyifeng@gmail.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 07/10] dns-resolve: Free 'struct ub_result' when callback returns error results 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 Valgrind reported: 1074: ofproto - flush flows, groups, and meters for controller change ==5499== 695 (288 direct, 407 indirect) bytes in 3 blocks are definitely lost in loss record 344 of 355 ==5499== at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==5499== by 0x5E7F145: ??? (in /usr/lib/x86_64-linux-gnu/libunbound.so.2.4.0) ==5499== by 0x5E6EBDE: ub_resolve_async (in /usr/lib/x86_64-linux-gnu/libunbound.so.2.4.0) ==5499== by 0x55C739: resolve_async__.part.5 (dns-resolve.c:233) ==5499== by 0x55C85C: resolve_async__ (dns-resolve.c:261) ==5499== by 0x55C85C: resolve_callback__ (dns-resolve.c:262) ==5499== by 0x5E6FEF1: ub_process (in /usr/lib/x86_64-linux-gnu/libunbound.so.2.4.0) ==5499== by 0x55CAF3: dns_resolve (dns-resolve.c:153) ==5499== by 0x523864: parse_sockaddr_components_dns (socket-util.c:438) ==5499== by 0x523864: parse_sockaddr_components (socket-util.c:504) ==5499== by 0x524468: inet_parse_active (socket-util.c:541) ==5499== by 0x524564: inet_open_active (socket-util.c:579) ==5499== by 0x5959F9: tcp_open (stream-tcp.c:56) ==5499== by 0x529192: stream_open (stream.c:228) ==5499== by 0x529910: stream_open_with_default_port (stream.c:724) ==5499== by 0x595FAE: vconn_stream_open (vconn-stream.c:81) ==5499== by 0x535C9B: vconn_open (vconn.c:250) ==5499== by 0x517C59: reconnect (rconn.c:467) ==5499== by 0x5184C7: run_BACKOFF (rconn.c:492) ==5499== by 0x5184C7: rconn_run (rconn.c:660) ==5499== by 0x457FE8: ofservice_run (connmgr.c:1992) ==5499== by 0x457FE8: connmgr_run (connmgr.c:367) ==5499== by 0x41E0F5: ofproto_run (ofproto.c:1845) ==5499== by 0x40BA63: bridge_run__ (bridge.c:2971) In ub_resolve_async's callback function, 'struct ub_result' should be finally freed even if there is a resolving error. This patch fixes it. Signed-off-by: Yifeng Sun Acked-by: William Tu --- lib/dns-resolve.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/dns-resolve.c b/lib/dns-resolve.c index e98e65f493ed..1ff58960fe01 100644 --- a/lib/dns-resolve.c +++ b/lib/dns-resolve.c @@ -251,6 +251,7 @@ resolve_callback__(void *req_, int err, struct ub_result *result) struct resolve_request *req = req_; if (err != 0 || (result->qtype == ns_t_aaaa && !result->havedata)) { + ub_resolve_free(result); req->state = RESOLVE_ERROR; VLOG_ERR_RL(&rl, "%s: failed to resolve", req->name); return; @@ -265,6 +266,7 @@ resolve_callback__(void *req_, int err, struct ub_result *result) char *addr; if (!resolve_result_to_addr__(result, &addr)) { + ub_resolve_free(result); req->state = RESOLVE_ERROR; VLOG_ERR_RL(&rl, "%s: failed to resolve", req->name); return; From patchwork Wed Sep 11 21:18:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yifeng Sun X-Patchwork-Id: 1161296 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="YyS+hEir"; 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 46TFGW4tskz9sDB for ; Thu, 12 Sep 2019 07:22:11 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 36EBDE0E; Wed, 11 Sep 2019 21:18:50 +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 C128ED91 for ; Wed, 11 Sep 2019 21:18:47 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 75EDF82B for ; Wed, 11 Sep 2019 21:18:47 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id n9so12190877pgc.1 for ; Wed, 11 Sep 2019 14:18:47 -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:in-reply-to:references; bh=QpdxWLodp2bz00/9cul/4U3jRkdvqiB0a0UGZGyMujU=; b=YyS+hEirdZ+Du1UqDsjR9NxvO4NsY6krws6fuZPteq75+5P1zbCJeEICEssDQmCjzS RUdWewpJd8kCxr0dBx6Yx934uN4/X4vm4NGGFviRatLKmg0k+fOofB8M8zhgVgONG3Ys dmmDcgRNVX+EYBVhWm+GclfMlePOMQMkK8OKTi7A+nyCXEs3GSGZdSv65lDDOMU5Jb54 VhREMWEeMYsqwyx8Os0O8uSHmudcbpNeOInek6xSBWEDf88UeoX+4FD+mxy7JKMD+A6v UyWTrRjEgg88ToBzrFUhMOW26DPyLCpxD5Enj1uyv+90S/Ejd5nnF52C0jWOXtSk7YWD g4Mg== 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:in-reply-to :references; bh=QpdxWLodp2bz00/9cul/4U3jRkdvqiB0a0UGZGyMujU=; b=ZeraHoHqjcErs2gGScH/eNhP8bhRv+Vm3Xpsu3UWWnC2erg/o3KRdVTSBCkcVGrs2j ug4WZfxNEhfmnKd3/+YEtdGnvJps5+aHkwwL+DccgknFsabKW8ukhzQKQHLqjO/feU2Z zYVhUap6tFQ7hxwA08VXcyqeLmAM3uDOp/0tHblqbx2FBZefCRiJW+pSmBWtVWjF6sM7 stCHvE0YVDhUnxG3ZHZLXarx9nBrkbkcSyFs1iStfIceFQV92YDfYy9dDHkJKMDABIVq IBWX/XsJyygYfeYZMWrs2seO31Ui57fmvbUAH4akZ9t8JP/YdiRosHom3+Mp9F0XmsZO MiIw== X-Gm-Message-State: APjAAAVdL1kOJ5kiNyvaLAhO/P1eo0T831BIZH8BcNpyZkONCZwRNZ8a JkSscE82x0pCBQsGpJVCj+j6TCcT X-Google-Smtp-Source: APXvYqwhMILNh8U2tdVeZQWM7nI3j95gEbZ6suFZ2qz4XBju0WCPfG2F3CbMYM4logcqCiuY/V17kQ== X-Received: by 2002:a17:90a:1c01:: with SMTP id s1mr7949352pjs.76.1568236726961; Wed, 11 Sep 2019 14:18:46 -0700 (PDT) Received: from kern417.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id k1sm24612487pfi.132.2019.09.11.14.18.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Sep 2019 14:18:46 -0700 (PDT) From: Yifeng Sun To: dev@openvswitch.org Date: Wed, 11 Sep 2019 14:18:34 -0700 Message-Id: <1568236716-18105-8-git-send-email-pkusunyifeng@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1568236716-18105-1-git-send-email-pkusunyifeng@gmail.com> References: <1568236716-18105-1-git-send-email-pkusunyifeng@gmail.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 08/10] ofproto-dpif: Free leaked 'webster' 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 Valgrind reported: 1122: ofproto-dpif - select group with explicit dp_hash selection method ==16884== 64 bytes in 1 blocks are definitely lost in loss record 320 of 346 ==16884== at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==16884== by 0x532512: xcalloc (util.c:121) ==16884== by 0x4262B9: group_setup_dp_hash_table (ofproto-dpif.c:4846) ==16884== by 0x4267CB: group_set_selection_method (ofproto-dpif.c:4938) ==16884== by 0x4267CB: group_construct (ofproto-dpif.c:4984) ==16884== by 0x417250: init_group (ofproto.c:7286) ==16884== by 0x41B4FC: add_group_start (ofproto.c:7316) ==16884== by 0x42247A: ofproto_group_mod_start (ofproto.c:7589) ==16884== by 0x4250EC: handle_group_mod (ofproto.c:7744) ==16884== by 0x4250EC: handle_single_part_openflow (ofproto.c:8428) ==16884== by 0x4250EC: handle_openflow (ofproto.c:8606) ==16884== by 0x4579E2: ofconn_run (connmgr.c:1318) ==16884== by 0x4579E2: connmgr_run (connmgr.c:355) ==16884== by 0x41E0F5: ofproto_run (ofproto.c:1845) ==16884== by 0x40BA63: bridge_run__ (bridge.c:2971) ==16884== by 0x410CF3: bridge_run (bridge.c:3029) ==16884== by 0x407614: main (ovs-vswitchd.c:127) This patch fixes it. Signed-off-by: Yifeng Sun Acked-by: William Tu --- ofproto/ofproto-dpif.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 46fa1357163b..7bb0f7bdb4f3 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -4871,6 +4871,7 @@ group_setup_dp_hash_table(struct group_dpif *group, size_t max_hash) if (n_hash > MAX_SELECT_GROUP_HASH_VALUES || (max_hash != 0 && n_hash > max_hash)) { VLOG_DBG(" Too many hash values required: %"PRIu64, n_hash); + free(webster); return false; } From patchwork Wed Sep 11 21:18:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yifeng Sun X-Patchwork-Id: 1161297 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="MGRT4n6j"; 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 46TFGz3jwxz9s00 for ; Thu, 12 Sep 2019 07:22:35 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id F2AC2E36; Wed, 11 Sep 2019 21:18:50 +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 B1407DAF for ; Wed, 11 Sep 2019 21:18:48 +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 5BC7281A for ; Wed, 11 Sep 2019 21:18:48 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id y10so10707326pll.7 for ; Wed, 11 Sep 2019 14:18:48 -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:in-reply-to:references; bh=wW9EruWOWKQvr+akIV2FCQ5JrbEW0IVSOc0OVy6+YTc=; b=MGRT4n6jECcXI9ML55gyV+WFQnW86gc0ZDPAL1r5VoR6k3f7CDcyPj1fNDYt/Hi8Vv wCfk5kTDxvUAchh6Lv7lQ6XjwnU95nunOOf21DiKwbUaL0TZ1yUeVFGnT1yMElQAezJB fHX8L3zKzQr/YKCVKsgD77O6meMb2ueS945bLDKqHPW5wIVgHL1cxA1oxATizRtiF+08 Qt5Wm8mHOUq+BW19PgczZaNJsPqJVjYsnjbyH+M0SlSqbplBxfy4qr/mIs9KnXVDUjMK Hrj/jUzhx097jtNuY1UrPhUidWt5VgxY4aivwJB4S1gpsKFREQsgqfZa9lB6OtRBethg KYZg== 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:in-reply-to :references; bh=wW9EruWOWKQvr+akIV2FCQ5JrbEW0IVSOc0OVy6+YTc=; b=IXdysu9z2zWD6CN1JrKlFODUDX5FvNbFWQsRuUCyXp+ntJv1UuEOhwas+bMceKmIHv sxgvr0biqsZM1UKS0moA3hoVqZ0Jx9CcOt7Kf1MoAMFLy3oQmo9VgaArojrJqtynJa96 YJPMQ/bctRdgRIWKC8VN/vptHLL6yw30eP/z71u4K03Egh4GrQJo35mB+WjXR8cnmtKi lDMAkESSDTDfIu/E0Rf0Ufm74KCdqJaxZMMmIARh7E8Kph4SkE8H0Tuz1JrjEG9yi0rG P4AgaiIAM50GKYJICWb11F+CZ0v7rbcqo8F7eRUE725IcoNpbSCf5DMZpaaNf7fRW7ZQ dYcQ== X-Gm-Message-State: APjAAAUmXgcoTjYV53AQsi5vQ7YMZckJontrKsWj0eEIv6dmVav6SWBm ETLpftHnTRo4QnRTAfnm6ChC8gLh X-Google-Smtp-Source: APXvYqw3qiSJzN0W2e0eSTeHIDaCCnbG4rbsaRSIa5XjGvJaeFU/SUU1iiybWeUz6YWwinCqBewQHw== X-Received: by 2002:a17:902:8f8e:: with SMTP id z14mr18186553plo.323.1568236727655; Wed, 11 Sep 2019 14:18:47 -0700 (PDT) Received: from kern417.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id k1sm24612487pfi.132.2019.09.11.14.18.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Sep 2019 14:18:47 -0700 (PDT) From: Yifeng Sun To: dev@openvswitch.org Date: Wed, 11 Sep 2019 14:18:35 -0700 Message-Id: <1568236716-18105-9-git-send-email-pkusunyifeng@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1568236716-18105-1-git-send-email-pkusunyifeng@gmail.com> References: <1568236716-18105-1-git-send-email-pkusunyifeng@gmail.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 09/10] db-ctl-base: Free leaked ovsdb_datum 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 Valgrind reported: 2491: database commands -- negative checks ==19245== 36 (32 direct, 4 indirect) bytes in 1 blocks are definitely lost in loss record 36 of 53 ==19245== at 0x4C2FD5F: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==19245== by 0x431AB4: xrealloc (util.c:149) ==19245== by 0x41656D: ovsdb_datum_reallocate (ovsdb-data.c:1883) ==19245== by 0x41656D: ovsdb_datum_union (ovsdb-data.c:1961) ==19245== by 0x4107B2: cmd_add (db-ctl-base.c:1494) ==19245== by 0x406E2E: do_vsctl (ovs-vsctl.c:2626) ==19245== by 0x406E2E: main (ovs-vsctl.c:183) ==19252== 16 bytes in 1 blocks are definitely lost in loss record 9 of 52 ==19252== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==19252== by 0x430F74: xmalloc (util.c:138) ==19252== by 0x414D07: clone_atoms (ovsdb-data.c:990) ==19252== by 0x4153F6: ovsdb_datum_clone (ovsdb-data.c:1012) ==19252== by 0x4104D3: cmd_remove (db-ctl-base.c:1564) ==19252== by 0x406E2E: do_vsctl (ovs-vsctl.c:2626) ==19252== by 0x406E2E: main (ovs-vsctl.c:183) This patch fixes them. Signed-off-by: Yifeng Sun Acked-by: William Tu --- lib/db-ctl-base.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/db-ctl-base.c b/lib/db-ctl-base.c index 3bd9f006acb1..6878d6326cae 100644 --- a/lib/db-ctl-base.c +++ b/lib/db-ctl-base.c @@ -1489,6 +1489,7 @@ cmd_add(struct ctl_context *ctx) ctx->error = ovsdb_datum_from_string(&add, &add_type, ctx->argv[i], ctx->symtab); if (ctx->error) { + ovsdb_datum_destroy(&old, &column->type); return; } ovsdb_datum_union(&old, &add, type, false); @@ -1500,6 +1501,7 @@ cmd_add(struct ctl_context *ctx) old.n, type->value.type == OVSDB_TYPE_VOID ? "values" : "pairs", column->name, table->name, type->n_max); + ovsdb_datum_destroy(&old, &column->type); return; } ovsdb_idl_txn_verify(row, column); @@ -1581,10 +1583,12 @@ cmd_remove(struct ctl_context *ctx) ctx->argv[i], ctx->symtab); if (ctx->error) { + ovsdb_datum_destroy(&old, &column->type); return; } } else { ctx->error = error; + ovsdb_datum_destroy(&old, &column->type); return; } } @@ -1596,6 +1600,7 @@ cmd_remove(struct ctl_context *ctx) "table %s but the minimum number is %u", old.n, type->value.type == OVSDB_TYPE_VOID ? "values" : "pairs", column->name, table->name, type->n_min); + ovsdb_datum_destroy(&old, &column->type); return; } ovsdb_idl_txn_verify(row, column); From patchwork Wed Sep 11 21:18:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yifeng Sun X-Patchwork-Id: 1161298 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="iAR5sKch"; 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 46TFHh4VBbz9sNf for ; Thu, 12 Sep 2019 07:23:12 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 0A527DD9; Wed, 11 Sep 2019 21:18:54 +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 52BDFE31 for ; Wed, 11 Sep 2019 21:18:50 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 4E03F81A for ; Wed, 11 Sep 2019 21:18:49 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id r12so14536852pfh.1 for ; Wed, 11 Sep 2019 14:18:49 -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:in-reply-to:references; bh=+SBiUXPypMHIVhXJ4LS9GOtKrgL8sfhf8mpuuRyhFkU=; b=iAR5sKchfd0pkU7jSEWWw3ZHAbQzVbkI3l07dvLptwlFOMFOvnDNNYmqRY1Rzf+4pU ooT+CdNPKmRMf3+vv/fK/wmTi1SL5Ckw4IRKGhL83/+RptrigyMFQcuZoAebGE/JoxP7 9jWgbEHmmmlJD/L4Kt6ooJSTEO9CJaXnARwwqwf2cfas2MNtgYna88NtNaKULrDTjM11 IzNqcmy6wj8hwTIZWyXGX9oVr1GY3GpSrwXhSHG00JJ8QBK3oE0/zV/XCWVnbGEArs0A Wi7EZ3pJdvPWMsbZcX5/DukBN4dhbTpUukBjmXzR7a3Eko8PljlxRGvr0MkHksaEFw6+ TAKg== 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:in-reply-to :references; bh=+SBiUXPypMHIVhXJ4LS9GOtKrgL8sfhf8mpuuRyhFkU=; b=dtNz4BBMfMlf3y05MF2Xx1d9YZ8x8XJbAJa2nUd5M0XVqsznJWc0MVe3zb/BhLU03P llGFGfEsQeIysXxfnpVXZGrcjLNOmz+YUeVc1Acei8kpfV0qHY2XMDfQ/TK1XMnMeTE7 sdDTyTuo+ISl4O4ohTIBQgW7QdmBImbMl0TeJVuwqrSmDBwDALoYeVgSn/GAJJXTzmns gbUGUvfXdPes12S0kFI2CNmwRph4qGnPOVhQt8Uww+cjQoT261wh31G1jM2eH7TI2Dtk eI2evIym1v4KIToR4Qy4QdRM1IRsrrl5SauDt7iFVvfc/moTxKNhPasyseWAqV3Cuh5i 5sog== X-Gm-Message-State: APjAAAXyLl93j0+xWJIxU3T9+ilU/80a4W2Os319GPEsIciomGkFXAYA +baBuC9qQDw6P/QBLJbneM5JITp1 X-Google-Smtp-Source: APXvYqy06kJIAZSChRmBl9Odi5IkeEM+8sqb/dePFXmcitNfHkERkMQzrkSKx4a4S0YJYYOT9ZzPRA== X-Received: by 2002:a63:5222:: with SMTP id g34mr1027286pgb.405.1568236728635; Wed, 11 Sep 2019 14:18:48 -0700 (PDT) Received: from kern417.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id k1sm24612487pfi.132.2019.09.11.14.18.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Sep 2019 14:18:47 -0700 (PDT) From: Yifeng Sun To: dev@openvswitch.org Date: Wed, 11 Sep 2019 14:18:36 -0700 Message-Id: <1568236716-18105-10-git-send-email-pkusunyifeng@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1568236716-18105-1-git-send-email-pkusunyifeng@gmail.com> References: <1568236716-18105-1-git-send-email-pkusunyifeng@gmail.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 10/10] conntrack: Validate accessing of conntrack data in pkt_metadata 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 Valgrind reported: 1305: ofproto-dpif - conntrack - ipv6 ==26942== Conditional jump or move depends on uninitialised value(s) ==26942== at 0x587C00: check_orig_tuple (conntrack.c:1006) ==26942== by 0x587C00: process_one (conntrack.c:1141) ==26942== by 0x587C00: conntrack_execute (conntrack.c:1220) ==26942== by 0x47B00F: dp_execute_cb (dpif-netdev.c:7305) ==26942== by 0x4AF756: odp_execute_actions (odp-execute.c:794) ==26942== by 0x477532: dp_netdev_execute_actions (dpif-netdev.c:7349) ==26942== by 0x477532: handle_packet_upcall (dpif-netdev.c:6630) ==26942== by 0x477532: fast_path_processing (dpif-netdev.c:6726) ==26942== by 0x47933C: dp_netdev_input__ (dpif-netdev.c:6814) ==26942== by 0x479AB8: dp_netdev_input (dpif-netdev.c:6852) ==26942== by 0x479AB8: dp_netdev_process_rxq_port (dpif-netdev.c:4287) ==26942== by 0x47A6A9: dpif_netdev_run (dpif-netdev.c:5264) ==26942== by 0x4324E7: type_run (ofproto-dpif.c:342) ==26942== by 0x41C5FE: ofproto_type_run (ofproto.c:1734) ==26942== by 0x40BAAC: bridge_run__ (bridge.c:2965) ==26942== by 0x410CF3: bridge_run (bridge.c:3029) ==26942== by 0x407614: main (ovs-vswitchd.c:127) ==26942== Uninitialised value was created by a heap allocation ==26942== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==26942== by 0x532574: xmalloc (util.c:138) ==26942== by 0x46CD62: dp_packet_new (dp-packet.c:153) ==26942== by 0x4A0431: eth_from_flow_str (netdev-dummy.c:1644) ==26942== by 0x4A0431: netdev_dummy_receive (netdev-dummy.c:1783) ==26942== by 0x531990: process_command (unixctl.c:308) ==26942== by 0x531990: run_connection (unixctl.c:342) ==26942== by 0x531990: unixctl_server_run (unixctl.c:393) ==26942== by 0x40761E: main (ovs-vswitchd.c:128) 1316: ofproto-dpif - conntrack - tcp port reuse ==24039== Conditional jump or move depends on uninitialised value(s) ==24039== at 0x587BF5: check_orig_tuple (conntrack.c:1004) ==24039== by 0x587BF5: process_one (conntrack.c:1141) ==24039== by 0x587BF5: conntrack_execute (conntrack.c:1220) ==24039== by 0x47B02F: dp_execute_cb (dpif-netdev.c:7306) ==24039== by 0x4AF7A6: odp_execute_actions (odp-execute.c:794) ==24039== by 0x47755B: dp_netdev_execute_actions (dpif-netdev.c:7350) ==24039== by 0x47755B: handle_packet_upcall (dpif-netdev.c:6631) ==24039== by 0x47755B: fast_path_processing (dpif-netdev.c:6727) ==24039== by 0x47935C: dp_netdev_input__ (dpif-netdev.c:6815) ==24039== by 0x479AD8: dp_netdev_input (dpif-netdev.c:6853) ==24039== by 0x479AD8: dp_netdev_process_rxq_port (dpif-netdev.c:4287) ==24039== by 0x47A6C9: dpif_netdev_run (dpif-netdev.c:5264) ==24039== by 0x4324F7: type_run (ofproto-dpif.c:342) ==24039== by 0x41C5FE: ofproto_type_run (ofproto.c:1734) ==24039== by 0x40BAAC: bridge_run__ (bridge.c:2965) ==24039== by 0x410CF3: bridge_run (bridge.c:3029) ==24039== by 0x407614: main (ovs-vswitchd.c:127) ==24039== Uninitialised value was created by a heap allocation ==24039== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==24039== by 0x5325C4: xmalloc (util.c:138) ==24039== by 0x46D144: dp_packet_new (dp-packet.c:153) ==24039== by 0x46D144: dp_packet_new_with_headroom (dp-packet.c:163) ==24039== by 0x51191E: eth_from_hex (packets.c:498) ==24039== by 0x4A03B9: eth_from_packet (netdev-dummy.c:1609) ==24039== by 0x4A03B9: netdev_dummy_receive (netdev-dummy.c:1765) ==24039== by 0x5319E0: process_command (unixctl.c:308) ==24039== by 0x5319E0: run_connection (unixctl.c:342) ==24039== by 0x5319E0: unixctl_server_run (unixctl.c:393) ==24039== by 0x40761E: main (ovs-vswitchd.c:128) According to comments in pkt_metadata_init(), conntrack data is valid only if pkt_metadata.ct_state != 0. This patch prevents check_orig_tuple() get called when conntrack data is uninitialized. Signed-off-by: Yifeng Sun Acked-by: William Tu --- lib/conntrack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/conntrack.c b/lib/conntrack.c index e5266e579452..86c16b2fbe77 100644 --- a/lib/conntrack.c +++ b/lib/conntrack.c @@ -1138,7 +1138,8 @@ process_one(struct conntrack *ct, struct dp_packet *pkt, handle_nat(pkt, conn, zone, ctx->reply, ctx->icmp_related); } - } else if (check_orig_tuple(ct, pkt, ctx, now, &conn, nat_action_info)) { + } else if (pkt->md.ct_state + && check_orig_tuple(ct, pkt, ctx, now, &conn, nat_action_info)) { create_new_conn = conn_update_state(ct, pkt, ctx, conn, now); } else { if (ctx->icmp_related) {