From patchwork Sun Jul 10 23:52:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 12912727 X-Patchwork-Delegate: stephen@networkplumber.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16740CCA483 for ; Sun, 10 Jul 2022 23:55:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229479AbiGJXx5 (ORCPT ); Sun, 10 Jul 2022 19:53:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbiGJXx4 (ORCPT ); Sun, 10 Jul 2022 19:53:56 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2066.outbound.protection.outlook.com [40.107.212.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7C5562E2 for ; Sun, 10 Jul 2022 16:53:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J9ee4KLMebCJ0f8imO22Fc4P4OrW09DoPC8zhOeZGlyw3WTBTwRcj5M2cN+mnk/WIjj+rKPrs5UPQ9YAsrfJ+7mmxbZ2aqqnCc1/O4+/O4N0FUuekEoqCYMRj2twmeNHrzyD4XibfS6ZHGQ8RAig//NOv+eD7OJU5CH4Ma/P0UdH6CqfJRxbXFkihnRWa8y10ZXZRMvY+JKW4EstcGvXna2z0/N5C2pCxAgd2SnurNjQCdCVZE5W40CJ0xaj8fiThCidXxX2DGjBQIlHu8p0W8L44dv6/K9hHUmuLFzoV0GPEBveXMS2KmRU7FbubWjWb4SZWk+juoXFXpfTFtxY+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6qIdT+Hp3hstPwCD/ZRVOfhA22EUTJm+gmpYhjDyqss=; b=T/rU3IXqJO1ZwJD1efJo+3mBYapHoL2yGqSifW4EHxotvlzHTjIKFL4BMo0pew6mSh7VB0A5A8bvOBgjMgufZNszozOcv/t7RR0hWb9PjfO4VAgptVlnENpQGg7a4o35o+CdjyW2jYSQZeD2csuMiLW1leQ4zMEgbhaW5bVnbOdH7OTUcJNFfO0j6vCrPLW7AWdLhZp9EaekUAQuUBhBjN/nIzejgq9WpbY69wpcvzRSplVFn+FSHV27ehgz1Ch9e/MQEnyOq4MhL+hY9Vv7/Fz5xBJNU3VY0EQWMPP4wiP+oXX4Rpsgct3yo1mu1bukYpwZs+Tqu0S2OkTRsIW3DA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6qIdT+Hp3hstPwCD/ZRVOfhA22EUTJm+gmpYhjDyqss=; b=jUH+QrvrpnjbMB4FPfmU9SxfBCrO/1mATliy6lVZLcduVkrb1G6My/9DqztjTqfuTiH+fGxc0E8ePXXTjfzRrrTr3+AvHThxlYPI0lmZAypxTVkGjtFkOV/Kk3z2kGjNy+BmU3MPcieTVNt+RXy1q7HjEO+FfHRqe3GNPiN7CIPTLydvH7m+Ypbf3aw4ooxSTTiWkreJdPxRfBdZ4kVW4lahiP1Enuqt6lY7AgET1t91S2K1nFOr3UJhCWw06MRpNbYl0Mb5rL3mUqJRRWceKSANNcsVWLFs+GQI2Xa3p4EyplRfsQg70P/7264HIj6fA4zr0jdDT8/FyU01kjnscg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (20.180.244.72) by BN6PR12MB1396.namprd12.prod.outlook.com (10.168.226.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.16; Sun, 10 Jul 2022 23:53:54 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::e9e9:810c:102b:c6e5]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::e9e9:810c:102b:c6e5%3]) with mapi id 15.20.5417.025; Sun, 10 Jul 2022 23:53:54 +0000 From: Benjamin Poirier To: Stephen Hemminger Cc: netdev@vger.kernel.org, Ido Schimmel , Roopa Prabhu , Paolo Abeni , David Ahern Subject: [PATCH iproute2 1/5] ip address: Fix memory leak when specifying device Date: Mon, 11 Jul 2022 08:52:50 +0900 Message-Id: <20220710235254.568878-2-bpoirier@nvidia.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220710235254.568878-1-bpoirier@nvidia.com> References: <20220710235254.568878-1-bpoirier@nvidia.com> X-ClientProxiedBy: TYCPR01CA0039.jpnprd01.prod.outlook.com (2603:1096:405:1::27) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b292dbb6-8424-4509-072f-08da62cf7225 X-MS-TrafficTypeDiagnostic: BN6PR12MB1396:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PZZyDEG3OyOxkddPim5Pd8idZM1m9Fin8EpPiOW0RMDNJx++3AWeLwZqniH9AnAnPkuXHMis3GMx/D9+SXgEAL3gQFGF1Xb6NzD0QENhX+T3CWD/4iKPQJtFIc9fTBK407KnDAs+f5RsoimF5Wz/zp+HUAy4arPkiV2xqqIDhYInOieJ4rO80PnHKBiJto3myCIVjruh0UwOg7HKzSJjOBx/U9zxGxT1zHViI7ppqyXhpkspvxoTDH87QbR5XPtoFoYcb7+wsRF3QtkbIB6uzOYuzX9VRGUJuNbG/dMlGmAFpIVfzSsV7PTzS4uvx8BmIhaBhbWYA5kE3BTwrHaDTRBfOxUTwS2UyoCFZAqhwqt60gLCi6555aFxG6c9tjSNoJl3Zkk+13LreY81MOyeO5xfG9MHzDBwbNU/nls6j5ulCFaVHopZ8n5jnxDmnU26FER9Z5VOUM7gT2zueebaDwGA73bZVHVIyPUB4NPVnXM2Gb+4XiIk2vNGBzskdwgnkd3c0j8Oe6wpPs0JpGHHyhVU7sA/ee6X1x2QaFvmPtscS/1EcmFaYrnmmeG/u/Mq88AAFFpHUhzpxwhRq8yv2HonruTwPpf9+Fm+27COPGgjYkxSBhbuHCAktmRoO/4KqjwnFufmkVErT22XEQYNTd51a27MlMnrCaXPB7NEk5Fe9KY941yw62DCVbe4lM0oM38IiBYrnNlw9MOXz4RIU3cDzzgCPpq2ttL1txKtYSYUAN+KaMLdzQ12uwxgBfw8 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(366004)(346002)(136003)(39860400002)(396003)(376002)(8936002)(6506007)(6512007)(38100700002)(2906002)(5660300002)(83380400001)(316002)(4326008)(66946007)(6486002)(66556008)(66476007)(8676002)(186003)(1076003)(2616005)(36756003)(41300700001)(478600001)(86362001)(6666004)(26005)(54906003)(6916009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hg76pO2OCVMj+th5VTJGmy2xP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Y2nBz+eOGn93pr2Oj4h5oPAB1PJ6VHNvAbV/ygfrE8GYRr4JXK2kZchGTqIV1FbzJ/o6pS/KU0UcoNLRTYdVYI8q7P8tSjyXNXYUkyqZMCLuJl3RF5SCLIjcgkpniV/9yc+Zrqil9SDJ11Nr9puzg25MxB7mlf97p30SuwlKRDamWADX5G3lLCDYV1aA1+4oavFArkM/xJgndjY0Gk/uBiP3OZve0U7tl/NYvRNIs/ZsDhdv5tTdLsq1dhsZBySsVT+CZvNMJYul0O1I1VPy3EiESq2i0IE0tDm6XJ/lur4PDNj54tTXzVlrf1lT6gPB4BO0vewEefWPXiO9Jf1k0bj3jbPMFx63RaF3wvm0lOKAJW2ZuzEhs8zFQnKTIfiHDdQ8gUfihg7AhCV3IMPspTz5nQz9Az9WPBMUdCiebJvMjRfwUGYeNy4XTZefi+29FmQo7laLyHUB6/j2B0qJzw3Bp+1cvp3lNw2NsE2Vs4 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: b292dbb6-8424-4509-072f-08da62cf7225 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2022 23:53:54.1170 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: O50Abcb74G0Wy/Y4OPvs0L/lkv9TIBgfW2qimgmplntyKJ4vaWu6GNJkX9VHCkPQLxQL7m8Q2XR7xYiZ2zAEIg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1396 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com Running a command like `ip addr show dev lo` under valgrind informs us that 32,768 bytes in 1 blocks are definitely lost in loss record 4 of 4 at 0x483577F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x16CBE2: rtnl_recvmsg (libnetlink.c:775) by 0x16CF04: __rtnl_talk_iov (libnetlink.c:954) by 0x16E257: __rtnl_talk (libnetlink.c:1059) by 0x16E257: rtnl_talk (libnetlink.c:1065) by 0x115CB1: ipaddr_link_get (ipaddress.c:1833) by 0x11A0D1: ipaddr_list_flush_or_save (ipaddress.c:2030) by 0x1152EB: do_cmd (ip.c:115) by 0x114D6F: main (ip.c:321) After calling store_nlmsg(), the original buffer should be freed. That is the pattern used elsewhere through the rtnl_dump_filter() call chain. Fixes: 884709785057 ("ip address: Set device index in dump request") Reported-by: Binu Gopalakrishnapillai Reviewed-by: Ido Schimmel Signed-off-by: Benjamin Poirier --- ip/ipaddress.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ip/ipaddress.c b/ip/ipaddress.c index a288341c..59ef1e4b 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -2030,8 +2030,10 @@ static int ipaddr_link_get(int index, struct nlmsg_chain *linfo) if (store_nlmsg(answer, linfo) < 0) { fprintf(stderr, "Failed to process link information\n"); + free(answer); return 1; } + free(answer); return 0; } From patchwork Sun Jul 10 23:52:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 12912726 X-Patchwork-Delegate: stephen@networkplumber.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04081CCA47F for ; Sun, 10 Jul 2022 23:55:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229497AbiGJXyE (ORCPT ); Sun, 10 Jul 2022 19:54:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbiGJXyC (ORCPT ); Sun, 10 Jul 2022 19:54:02 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2046.outbound.protection.outlook.com [40.107.212.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B34E6336 for ; Sun, 10 Jul 2022 16:54:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EScz6rXx1NdE5QI0Zxol6KCKUnpD8TN6TXymhcz4DvjXGkT2XGKUw04e7/PkeyJ5Voxe3p5iz3ILz8l6NcQBkBjDdgEYL5Pill4NGzdotBgU0VUe3Wr1+HEZ2kFhIAhCHddWbdh0LGgh8imhUj0T9XPm7bitkn7ha+9GrhgsxUSsxXm22RzyzLm+1PkWWxFrYuhRc/R5aXLxmB8vhX3bwMzD5MpXr7R/qn6HEH4Ij8KxBQK5fEiz5oNsFNXCUG9bLre2IMQSLoQvuCdO9EBlaQATRtpL1jfEW1Lht6bc3t4pj3I2kD45Ya3NJRS07IW0pidpF0JeeobqD283tVokKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FHyX09ttzXWVJD45Xlm7muR/RO9dB3sAwyow7mBLb/s=; b=e8zHJtmCxEF2P/WlOFl74mK37RlK5HcA1YwZbD+kNMMMsSt8aohJmickq7ycfb8QR+7RJfLQY6C+b+6yEpM3+ny5vTxqvSifj0LbdSaegRTNkV2/EV2l2nXLTYYTfJpHzlo2XUX1tTJ0s9V7acVauv98dfbdW/M87MpCgkkbeMYlEacWaBLEZ5s+zIX5eEp9OTAEBpH4OJYyl3JkDph7khML/dey9fQzUVUj7aN8aKhv6lF2uPHleBn5Z7cov2NY4mcdVfKnxu57FsJFv27ls2kXXz6EopcJakZxl7eVP1iJCOj+og8G2pHbaTW1ybiSZRBugtzombwQfsJsrreF4Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FHyX09ttzXWVJD45Xlm7muR/RO9dB3sAwyow7mBLb/s=; b=pny5JrwQI6prvf37DPcYbxKVx0vmbpaYuJew69n/cwOWj7+HSGCfptgg+3FEfyDdYnSCtIWJJrDccMw6AaOGcOUinbRx0+TFiEEdJRnhWDxKYA87fBqdVq8yHAxLd5d8kzRA8PTF4WDbD6eeJ05aNOPk10CaJo7xlqnUaqDpf65HtoD1tb+OY7GHcOGayertFfA+NdjFInxkH/Qw5P9FE0k3eUA0OMifNf0m3dZUX/LkmmBHCiObFBS8sF6c5MgV8uU1T1b/gBRpFK6xBOHlzYskCTxOvbdkgYzG6h268GhlQHUcqvMEOacIW9suvI0Mmn2D8dtK9xE7OoLYN4Vr0A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (20.180.244.72) by BN6PR12MB1396.namprd12.prod.outlook.com (10.168.226.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.16; Sun, 10 Jul 2022 23:54:00 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::e9e9:810c:102b:c6e5]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::e9e9:810c:102b:c6e5%3]) with mapi id 15.20.5417.025; Sun, 10 Jul 2022 23:54:00 +0000 From: Benjamin Poirier To: Stephen Hemminger Cc: netdev@vger.kernel.org, Ido Schimmel , Roopa Prabhu , Paolo Abeni , David Ahern Subject: [PATCH iproute2 2/5] bridge: Fix memory leak when doing 'fdb get' Date: Mon, 11 Jul 2022 08:52:51 +0900 Message-Id: <20220710235254.568878-3-bpoirier@nvidia.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220710235254.568878-1-bpoirier@nvidia.com> References: <20220710235254.568878-1-bpoirier@nvidia.com> X-ClientProxiedBy: TYCPR01CA0055.jpnprd01.prod.outlook.com (2603:1096:405:2::19) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a8bba92b-f959-4e41-5a71-08da62cf7616 X-MS-TrafficTypeDiagnostic: BN6PR12MB1396:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DT4Xa31sdABNJqQbDA2nVoM6jLvTD1M3aLmXMvjmhJtThSkPDOd3Draxigt0qQjudZm8SI2Uw9EWfBPEx38tamGwIWad2cLTCc3Z87RqnY5HsccMtgFqyeyGtKqVVZt1dtBO+8QJsMzG+dQy45I1YZV/896xNtnL+EqkVgJ0gfaHiu/K36DCK6GUWB1kmglPFYlsLpfYDdI9TmIgUJqu59UmCZtDHgM5L4aqTYCCM0lfit9yXAirnmfvS8YRDk7hl7oLhDTI7e5r+kD11o1nGwrXtJWEN8umlI0+2hJPr6ZXEMuSnuJt5Z/K6BG1Qu9nFD5r4DclxNEb/GMo8p1Ep2vGXKBIHVSX6wl9yQuKVAx3onl+YMOKgDEdeheu+n/zeAzNq68m/YDhAsQd5FuzjTIKWjPIzc4q0YqCVVBCF70zGXt1tFYj0bTJ2pmP+xPBiYOCe/OLpxCF4qj9j0BbE3koLTa2rfCTJqYqOd+WFaigymqB1VqytFA1FvSvyIi8IJa/LLVA0Rve0EhQLrGqA1RFBp6DOsY8HVzqiVEwHXLy1n/qOdxrEeflgbQf4HaoOnm+ndoWB8GVIy4TvdZ0YLahjk+xIdrdrqtoJnpKPjG79VV0JbFU9Ia28wNU1xE1HaFhREtmzKNZNzGuceIWI8D9HAilymrjA2NKEMO2kNugqCKmlRD4flbQpTW2b5DwWjGDHCo143h+3M6bJcrKKaenQpcBmtNLcWzNaBJA91B9gRDi6x1Cfi6DQAn6GXZY X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(366004)(346002)(136003)(39860400002)(396003)(376002)(8936002)(6506007)(6512007)(38100700002)(2906002)(5660300002)(83380400001)(316002)(4326008)(66946007)(6486002)(66556008)(66476007)(8676002)(186003)(1076003)(2616005)(36756003)(41300700001)(478600001)(86362001)(6666004)(26005)(54906003)(6916009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BGPkBPTZmkG2VTkidJg5uDFtC52gK8jfT/Y1w7jETu9eQABin1GnTIslFz8FQ6fawWENs70chbmwmLGOtVh0jctDM6jQB0bDlkvSGBaJsTi1a7gQyQ92mPGGpRgUuQrK28qAFCyZF21xDkC+ESelKlVLWwNokKAcKRE6frXjBvgKfAeWXBKWONmqZek4to/UamY280oW1li/9MjfCM5Y2sNm45Ywvbb/RaICu2ItrF6dyP81NvnkXeEmFS8Glx4i73avj++PYdAeRyVNG9LDWbWXd/hR+TZDKdj/8QFKj8T6roV5whPvPEDwtr6agKF53hrmZhPwrf0PzIqPQeh3Vsw2hDv3YfLvGgSeKWQ4jefXIxYUc5hqMT18lq+jb5usLAyq3zz/LM+rPsiLbEdIHFWpjyEIzfRQkszbMK6mTRuS7EseqO3IDpo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qEkCligPVIuCPDmhzVxwUbu4S9V6mLGSexIBPALd/fckmeVQmaLJmq9vLmtzQoziW7hq977Vr0mEoyF5CpEBpdJPU4D X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8bba92b-f959-4e41-5a71-08da62cf7616 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2022 23:54:00.6837 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6Byanw/PzVVcL1qul7adIyEHPNPSbMSmHtHePjanNHFzFpaqP9pTYr4Z4cgUJCVCJs1acuYcoY2qvs807sgyww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1396 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com With the following command sequence: ip link add br0 up type bridge ip link add dummy0 up address 02:00:00:00:00:01 master br0 type dummy bridge fdb get 02:00:00:00:00:01 br br0 when running the last command under valgrind, it reports 32,768 bytes in 1 blocks are definitely lost in loss record 2 of 2 at 0x483F7B5: malloc (vg_replace_malloc.c:381) by 0x11C1EC: rtnl_recvmsg (libnetlink.c:838) by 0x11C4D1: __rtnl_talk_iov.constprop.0 (libnetlink.c:1040) by 0x11D994: __rtnl_talk (libnetlink.c:1141) by 0x11D994: rtnl_talk (libnetlink.c:1147) by 0x10D336: fdb_get (fdb.c:652) by 0x48907FC: (below main) (libc-start.c:332) Free the answer obtained from rtnl_talk(). Fixes: 4ed5ad7bd3c6 ("bridge: fdb get support") Reported-by: Ido Schimmel Reviewed-by: Ido Schimmel Signed-off-by: Benjamin Poirier --- bridge/fdb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bridge/fdb.c b/bridge/fdb.c index 8912f092..08f6c72b 100644 --- a/bridge/fdb.c +++ b/bridge/fdb.c @@ -571,6 +571,7 @@ static int fdb_get(int argc, char **argv) char *addr = NULL; short vlan = -1; char *endptr; + int ret; while (argc > 0) { if ((strcmp(*argv, "brport") == 0) || strcmp(*argv, "dev") == 0) { @@ -657,13 +658,15 @@ static int fdb_get(int argc, char **argv) * if -json was specified. */ new_json_obj(json); + ret = 0; if (print_fdb(answer, stdout) < 0) { fprintf(stderr, "An error :-)\n"); - return -1; + ret = -1; } delete_json_obj(); + free(answer); - return 0; + return ret; } int do_fdb(int argc, char **argv) From patchwork Sun Jul 10 23:52:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 12912722 X-Patchwork-Delegate: stephen@networkplumber.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3A9ACCA479 for ; Sun, 10 Jul 2022 23:55:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229515AbiGJXyJ (ORCPT ); Sun, 10 Jul 2022 19:54:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbiGJXyI (ORCPT ); Sun, 10 Jul 2022 19:54:08 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2089.outbound.protection.outlook.com [40.107.212.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0C8D63D7 for ; Sun, 10 Jul 2022 16:54:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jnbCQ++qSYqHSm4MLo2F1/pjI5E8jkHkwRV9AyF18DhgxdeRqrkrL3cam09NqNzf85F4d74oV2fL6zM994/NpWLB7I83glBuvimdhZ2piO4KIQMmi91+kZQ407KiNeEuFxhjrbMXf1EiFxLfMEevwxqEhIhHoqpdH3E7hHsmviMPpZKnXz1Nlx23IhhYfWlxd5ro4bpn1zaazYmKYcq1d3srAUY/Qy3o+KEZ6mXJ6pNU2BpWc1qK5xU5Q4XGqw0SSJYwnVYgpsR7q5O8cegVuctEHg2+Sb4WaajsbBKdHrY0o1Uztw4Qx344ma5g/TUgQLuGAZ04+yDtIh/uC1legA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=L0/ksnaZLM0utP73tqpAa4X/3ECEtsMqnISEsIK0VQM=; b=CD4nDsjhoONz/K37OHljl+SD9mYNDKLhJnL9sDEUz16doqAtp2meH5YW8TR/+3LLjsOZhRLEw2oTuWvadhsF02LbaNuqAsZaaAlcGdt9L1G5ghCJ+1EEsCaTM/Cvn19FYElLjrDwiGL/TQUKUjctJ9HuHr3EX6IWWvWP4sWbrpZL9cg5Ay5Ec9yWhRrGwcInQePdhbm81a7Fs4CiPIHSQ62ULeUDNUtFBu6o6nma8nEKgB4hfAXK0jtWfhYTKAsZpXEGYTtVhwSE1r5zx27W1f4d76F/5AIj46HMkUTSlxUHe4T9TiPuXwVHEz8Nn9Ey1dx+KFsOuC1xMh3JyEM/Gw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L0/ksnaZLM0utP73tqpAa4X/3ECEtsMqnISEsIK0VQM=; b=fqb6MuWkgo8oaSrTHq6OVPak+oeXbJrl4/PE51vU6gZ8fbMxoy3oGDTCTsXni7HypCga+Kl2oxtMnjYB2+y2jjtzrrAJ7dL9BnBE0wATMc/ONtHA5/eLDx9eQFvB36HTH5GFRam+s2SLJb+LwqTo55CxPJ7IKW29J3U2V22+obyHCroihHpK+NPmyQO6F/vej9iF5/OX8bltkXB63wGK2d57gtrIBR9gDi9tQ6QchC2iU6snwzbMDrOFcPJvZbziOsXW5H92DXoB4LOOr2pgaYfm044g1N4jEYHSL8+6aJ+cHUU9N82+Zgua+oPJmOs/v3et2Wmzh6ZjBI8wtY5p5w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (20.180.244.72) by BN6PR12MB1396.namprd12.prod.outlook.com (10.168.226.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.16; Sun, 10 Jul 2022 23:54:06 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::e9e9:810c:102b:c6e5]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::e9e9:810c:102b:c6e5%3]) with mapi id 15.20.5417.025; Sun, 10 Jul 2022 23:54:06 +0000 From: Benjamin Poirier To: Stephen Hemminger Cc: netdev@vger.kernel.org, Ido Schimmel , Roopa Prabhu , Paolo Abeni , David Ahern Subject: [PATCH iproute2 3/5] mptcp: Fix memory leak when doing 'endpoint show' Date: Mon, 11 Jul 2022 08:52:52 +0900 Message-Id: <20220710235254.568878-4-bpoirier@nvidia.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220710235254.568878-1-bpoirier@nvidia.com> References: <20220710235254.568878-1-bpoirier@nvidia.com> X-ClientProxiedBy: TYAPR01CA0050.jpnprd01.prod.outlook.com (2603:1096:404:2b::14) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: de336888-4a7e-4a0e-38da-08da62cf7941 X-MS-TrafficTypeDiagnostic: BN6PR12MB1396:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 76Hd1Z07ZM2eSqhViO6tEpAaqiXG0TKcRoV4bNSBaQVthJ1bZzHfrre9/mgJdUjSxVPitHK7yKatWamSx5XfYqa9RO1U2bzvoKWPkiHKEOzbWGmfTJBCU7gsrQEccQIqjaszrNdlPm19rr2XeWgUdWjuShifqTRx+gcF9uZVMIzFH7DOeKyU39JkwgawAHAhzJ3hmFmgyiSFkhvAhSmNCkSA+3Inkmg/2s0JC0U5WQw2bA6msBnL+RZAI7/9MHzLQZz/V6ty/52Z+UgMQyOHHqBZs0DZVUM/SpZgwhamhZY6x8qKv74J/zMCBgqi+O72bB/4r82R4TIV5XNJAdTxHhe9fzPDN0d7NfIGn7LJrK8HqQVlfRcoAMrquYPbKmr/yq8jL1sF1aKWsZ5S1zXKjBqsQ86aMdoh72hzLfqMdzueHW8e03CFnjvXSstnoQ1KLhFDNfAFUiNi6jGhA+f2foAyryqI3ie4zi4LyHuqZ/ZUe1lK5hyoIVKQqQUjvF8dzFwrsonZYSgh7/vyjLznajm1q8rV79HqQKfLs+pOKjJChk72XQqkS3BdKzHzl9o5bsi+rmx4Je4SEF6vV3uTkxvyUCKj+zNm0JQCVEJhpkW6glL7bQ0oRb4NLE/rOBEO1qjKgzoEow9e33CoD7NVzPHu9Iqk9cWGSJ1iJgzpXoWsi9a5yXXQ4rQWDZ1lKW3rYPZQbZNr82R/Xcx822h/ICvmRn9nMaa+X7wmYFmQTTBjpI3DcBteO1ixgczjAcJT X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(366004)(346002)(136003)(39860400002)(396003)(376002)(8936002)(6506007)(6512007)(38100700002)(2906002)(5660300002)(83380400001)(316002)(4326008)(66946007)(6486002)(66556008)(66476007)(8676002)(186003)(1076003)(2616005)(36756003)(41300700001)(478600001)(86362001)(6666004)(26005)(54906003)(6916009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 86rbtI17iaFBU+lUC4iez7ujcHIh2iYs3SUfNVV7HHWYyL/ft/MYz6ABBmXBv4yfoat6tJLgHY9Skm3uRoQd+crQ6lM++108XxArVadpKfAlMZPrtfLyc9yFxC5UirpDuYQGeOJ34JrDH4fM5N0Ayuwt1PFo95+Xw4qeEVIKIR1tJfpOQhGB/Xmw/aNVoQ0DYZ9MHg0oDTP1oentHEWAhTmaQ+bpQTlmr/Ye0EZROCCmMgZjGQ6e4N2Ailc3Hgwi1q8vmJbYRPuAzG45Di/T5Y6fZs7459uja0rjxXz+XRqsBDvTj8pZ8meuU5S6Wsbn6VzXameOgprjBERiEW2vA2XI+5vrAjYn9S7G8hTjn7i6EN+mD17PUbGRASzgKAwm7sJ6CjlUNtYJ4eIJXgJjhTOiukWj82B/fafaPSI+Lo0HagfW8f81qKGCY7H41musK8MQNSpXeBHPkJ1Bq0pGy1UaoefojNc+kub13svFd+QI40iEyDCQBB1l5IDSMiljeexf3y1b8RrzA+L6E9pMSnJsXutoZv3z2n+hnJODRGsJTkqWDtzvOUjadnDWGXN8o/S+Da4m9qWKWuZ8Y+xDRSbIF//1O3Udi1aiV1f8bzzqYfU1ExgojZhe+Y1PDFFWoGgeY0y45TzPTtV8wh4relPRL7MdYyvFPrq7N38L9YGVlObcwbixQNPRUnWsIkNAY/HWIWdd44lS4S8xRVjTzPfMxsvmO8qz58WbX3/Raneh72aNRvQfRYgZrafRSj4TyS7YKPNn4o1/8IsswU/TT/qsvQ2mqqKkwI+EtHpOGAAt36lBN83kfWniK9BFw85LNG5Xtu26gP+2IzYiwBa4hTWJrvgadr3ZCDO8FGANvab74MrAXbSQiVXhwfA4RMs9NlY7lzhlQVvrGzCKCTf3eGPy1Z4MTXmfFpMmqnTuUiNRe73tndYBoqd4Zc1mOD6fN4sJUo182bsdiV5bqShLU8lEMtLJUJz4dOOQef9ntsIypsBpzs3M96Q5eLA8iFHLdysca7zgF3ybkPVyQ24k3fBVElDa4nnZUrFXrBPtK0ltI9QAfzAjF7tP9cKdrvCYgraxfEIhFd3qGbbefpM9ZNU1BPoaRuzSb9+p3OjwZuNS+Db87EHhKC0ruwU8NhwjzfRyGtirbZ2723UzIya9tUTDLaDlfsma4+AWu0ASTM72wSYzz+/UG/OAbZ7o/NAeVhEbC8/AmKHQmsIXuK0dWBYS/NWerY67HQBDWhWJpSaf/WTJXB7g75+QtTE1/8uMgupdPBim96FLINXW48viKM4QZB7IBQDvC66yC9awNixs+oRTGGkh+kyo9BYJ7EqKjkIKuyaHAVR8sP94sCl1L2UD6y3Sqd/J/9JsnRB7JWi8Xj2KZe4xByw1MMPdizt2iheEdNH7cIi4zC9K9eXp42MADfrva9ecLf2W6/8Kx7fmXkyeyvkRveU0zd1/j6u4TsFbrDgtNaIso3zQ2tamrJ25WrA++bYIOQmd0rK2kmCL7Vzq3FOoHarLGnqzfrDDvpFP4eUjAPKZVOYLbKEV4edV6xsXC4nVEHMOd/6+XrY1USdY5LPLRjqjH+u70KFF X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: de336888-4a7e-4a0e-38da-08da62cf7941 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2022 23:54:06.0759 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: l6IOeNn5NKR5OklzOCr8bNO5yYouEmb6BBvn3Xi39ghjVxQSZ0RGDJHzZxBjr9yTkG0jXEapOvW1YW8fwJtuwQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1396 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com With the following command sequence: ip mptcp endpoint add 127.0.0.1 id 1 ip mptcp endpoint show id 1 when running the last command under valgrind, it reports 32,768 bytes in 1 blocks are definitely lost in loss record 2 of 2 at 0x483F7B5: malloc (vg_replace_malloc.c:381) by 0x17A0AC: rtnl_recvmsg (libnetlink.c:838) by 0x17A391: __rtnl_talk_iov.constprop.0 (libnetlink.c:1040) by 0x17B854: __rtnl_talk (libnetlink.c:1141) by 0x17B854: rtnl_talk (libnetlink.c:1147) by 0x168A56: mptcp_addr_show (ipmptcp.c:334) by 0x1174CB: do_cmd (ip.c:136) by 0x116F7C: main (ip.c:324) Free the answer obtained from rtnl_talk(). Fixes: 7e0767cd862b ("add support for mptcp netlink interface") Suggested-by: Ido Schimmel Reviewed-by: Ido Schimmel Signed-off-by: Benjamin Poirier --- ip/ipmptcp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ip/ipmptcp.c b/ip/ipmptcp.c index 0033f329..54817e46 100644 --- a/ip/ipmptcp.c +++ b/ip/ipmptcp.c @@ -337,6 +337,7 @@ static int mptcp_addr_show(int argc, char **argv) new_json_obj(json); ret = print_mptcp_addr(answer, stdout); delete_json_obj(); + free(answer); fflush(stdout); return ret; } From patchwork Sun Jul 10 23:52:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 12912723 X-Patchwork-Delegate: stephen@networkplumber.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA622C43334 for ; Sun, 10 Jul 2022 23:55:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229501AbiGJXyT (ORCPT ); Sun, 10 Jul 2022 19:54:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbiGJXyS (ORCPT ); Sun, 10 Jul 2022 19:54:18 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2076.outbound.protection.outlook.com [40.107.243.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6C116542 for ; Sun, 10 Jul 2022 16:54:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OOVFFJRxDYpgriE8cCXin84BponldT/TgLKNhmHKPUee/0ZoRuqw5Jb21k2ZmQS7Qwxq8be3RiIwdcHGu2vJu2vyVQ99fTgGbUXcrqS40nrG6w18bp4R6EzuSYkjXTME5xDzIU2kCy3a9Wo4ORXsYLmNdJAy6qxdY9NrgqUynDQeS82nJVJC7Q1dx0Eo0xlRK8HZ+qIKnsysbZ7SJGZqbFkuK0447GrekcskSy8I9yYWkbn4A/OF2xtvld0FCoYbqvw2JXiEvrrmTIrwevgQeJ3Jpn0deJ/+gvy3YDFlFepiwKxMeid6vIYIinYehNqgEfv4tcYzJetwOZ1R490KYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZkElwooMX/IE+kElTOzMu0fY+9ORPwWrL3n1AiU9AiI=; b=DizdSI/YauqpGSdIwXaXwRUTIhNbGsY2P58pLRw96gv9ZEQHozmaRUlA9JIDKS737RN1AFWX2Kn9oOr0L6KRa/jOC4KFO7mirER27MqBFb1/07DbhD6FzZgt77EJtbl0GU0xLW3Y4zM4+vDrs8sRHDjWkO3sdgOirlYu63INrELBKD5v/Z8IMOoXArfj261+rADTFO5qayBAeHeRMM1WgpDX5BrnE9sYeDVBgiO3cUL09YYWWSldetLex/2M8//zl+WAYvoZQhjylO/v0TkPdHta5V238cm7sP+N4N0KQyXZgTd8BweX/XXildgxZKXld4bx+PesvseyGLIzJS/Jmw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZkElwooMX/IE+kElTOzMu0fY+9ORPwWrL3n1AiU9AiI=; b=TvcLsxzAIIB+u8O1saVHqPdELR6hHtns1OhuHq+16kQqCcNAH+N8XfuJjYPB7nM9YWAM4aXzQVVXS4wtnRDj8V2hWrTbeIMm3M3628adih4b6JGjLrNZGrcnML9IYWZpvsuwVQ5lUGeJvn34X1esqQNwXa5FygCMVz70IhL6wpQIjhb/H0u4d+qmHxqWq/Ij19BH31LGHkkn1Jf00Ry3UGPr6LFkMdzzvTUS5oIwQOjpMa9PnfAbXJgeyp3RWE7hirl6ZYC+r4jQgh+11bu2QKVGlhqwGdOMo4aW62n6gH7H8iOFJJwTAUnHnBEQKkilcSAAhN9juBY8OjSYu6y+hQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) by MWHPR1201MB2542.namprd12.prod.outlook.com (2603:10b6:300:e8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.23; Sun, 10 Jul 2022 23:54:12 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::e9e9:810c:102b:c6e5]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::e9e9:810c:102b:c6e5%3]) with mapi id 15.20.5417.025; Sun, 10 Jul 2022 23:54:12 +0000 From: Benjamin Poirier To: Stephen Hemminger Cc: netdev@vger.kernel.org, Ido Schimmel , Roopa Prabhu , Paolo Abeni , David Ahern Subject: [PATCH iproute2 4/5] mptcp: Fix memory leak when getting limits Date: Mon, 11 Jul 2022 08:52:53 +0900 Message-Id: <20220710235254.568878-5-bpoirier@nvidia.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220710235254.568878-1-bpoirier@nvidia.com> References: <20220710235254.568878-1-bpoirier@nvidia.com> X-ClientProxiedBy: TYAPR01CA0078.jpnprd01.prod.outlook.com (2603:1096:404:2c::18) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2c2836bf-cb95-4c6f-791a-08da62cf7ce3 X-MS-TrafficTypeDiagnostic: MWHPR1201MB2542:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: N79pvLIBFo6UAq+fWc6jriB9AETJ3Y2Qw/Z6lZNLymH/lVu1+tGQq9q3kng7vh2eaNPb/zlwcKDrQH4MuhbZrPHHAI7zerdr4C2BwIdWYot0Wp0//t82/M2hStqun2RMDc+Wuu3AcTRrutrevl48AmDv4nLR2WMbktO/b3m2n1Ugb04+mg0Y6IXtBIoHKvUPLPTKixIym1iekyekglgCVUYF66l15jOssbEcXSv+3akr7waUoHtwBTc9qstTcAwgY30ICC/5ef7VKnKy624deizioZbZQLjBetk8WuuPWi1ZN7VrWI2cKYQKFQ2bpM4+IFwITJbpno5MurnKzHscqSbEunEYLvXp3wiQXu8ukgtxFmQ4MFKBTO75T+xWfqr8HO5RaEGxZ4vqRBqOZaLmWiVNQTH8ik/6v7PJCPh9zIcCrVy7AsKmcgT5zTV6WuuzDG/nBWItsC8dJ7KPejuGjFHt+IT4+D4ia61+qchrLwShBncHJbxtUfMFEM6tsXzaLLkRtfMMIAE2J7aHorZGjlkSW0B0eYcRO9j9NG4HzwJzZnolon/haiwJQVbQFaDpng7U1GhjG8r91zej+CzWsyAQwMSPXnRtpVryBHUKG84NtK6avkpKgs1dJ3m6s0yuQKcRWbGwPmB4+aWJy52LmmwMiPyX76AaNjct9GIxZiiSUhZMFIHrDkSGhn5n4qlrkqYAYaRIGcpAsAW93SFhaw7bZ1C6YAdwVlFmshn+gzuGIo1S48lAMJWoNfM0lVZa X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(39860400002)(396003)(136003)(376002)(346002)(366004)(186003)(66476007)(8676002)(66946007)(4326008)(66556008)(6666004)(1076003)(86362001)(6512007)(6506007)(478600001)(26005)(6486002)(41300700001)(2616005)(54906003)(6916009)(316002)(2906002)(38100700002)(36756003)(83380400001)(5660300002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hokCFolXxbW0HdcnddeOMB/FzDrVLOWo5V8ZBpbJRzkpE2elUEjoisFjFqoirtHGZ6OGeCPnuf/J4SKbDCM/P9OdEao/zwwv5rqna8jwsj8I0PVFtYrsgWh0K+HUT1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oQfG0Zvnh8rtdaFpeeUr8KIOwvLYcQ9Qo37XxaYhfwQq+EUf+K8V0+F9WAhhWcWlwRZnSO1r1Lmlv+xY0rqnpVdhd+XGERNO4xkcQfdLbmddlF1nVYQywjTniwLh2p50GCZ4xT3bRrtL14R7qmL4CMNg7TuBVKs4MWa0JxYNo17uoo9eUpNTePPMHzJICdubwbLAJc/TtoHZMb95JwIO8xgECaZSj/WnauVmKIfLRkIU0yuWYrSrlQpXQS2zcg0SC8j+FeuJFcZ168i3mgIocR+FaMvxsWIxrxZg6xzsbWlz7CQY9PNtNZ8WtWv5EG86c3XMHzEAmNHxTgFIp0Ev0HzeLlFiG/4HTPtNfzRKKyvXbomTeVw7bGjtXQHyuexEGovxWIIny X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2c2836bf-cb95-4c6f-791a-08da62cf7ce3 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2022 23:54:12.0787 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5rMN0FC9UUFl8ZT3fToMMmL6Ot68EbvXoD6IJWOnopyymMfSK4VrSZDb/+9+dyq1FPIr4V2f2gKU3DthQ/kzdw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB2542 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com When running the command `ip mptcp limits` under valgrind, it reports 32,768 bytes in 1 blocks are definitely lost in loss record 1 of 1 at 0x483F7B5: malloc (vg_replace_malloc.c:381) by 0x17A0BC: rtnl_recvmsg (libnetlink.c:838) by 0x17A3A1: __rtnl_talk_iov.constprop.0 (libnetlink.c:1040) by 0x17B864: __rtnl_talk (libnetlink.c:1141) by 0x17B864: rtnl_talk (libnetlink.c:1147) by 0x16837D: mptcp_limit_get_set (ipmptcp.c:436) by 0x1174CB: do_cmd (ip.c:136) by 0x116F7C: main (ip.c:324) Free the answer obtained from rtnl_talk(). Fixes: 7e0767cd862b ("add support for mptcp netlink interface") Suggested-by: Ido Schimmel Reviewed-by: Ido Schimmel Signed-off-by: Benjamin Poirier --- ip/ipmptcp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ip/ipmptcp.c b/ip/ipmptcp.c index 54817e46..ce62ab9a 100644 --- a/ip/ipmptcp.c +++ b/ip/ipmptcp.c @@ -436,9 +436,13 @@ static int mptcp_limit_get_set(int argc, char **argv, int cmd) if (rtnl_talk(&genl_rth, &req.n, do_get ? &answer : NULL) < 0) return -2; - if (do_get) - return print_mptcp_limit(answer, stdout); - return 0; + ret = 0; + if (do_get) { + ret = print_mptcp_limit(answer, stdout); + free(answer); + } + + return ret; } static const char * const event_to_str[] = { From patchwork Sun Jul 10 23:52:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 12912724 X-Patchwork-Delegate: stephen@networkplumber.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E53D6CCA482 for ; Sun, 10 Jul 2022 23:55:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229514AbiGJXyU (ORCPT ); Sun, 10 Jul 2022 19:54:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229502AbiGJXyT (ORCPT ); Sun, 10 Jul 2022 19:54:19 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2077.outbound.protection.outlook.com [40.107.243.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41FC56370 for ; Sun, 10 Jul 2022 16:54:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WD3/Kvh/Sng/bcYc1pzJoaeaSqozYDRzCq0a2YcnoCmhV0Pa+rYV248e/Xjt5M1gPZOuJtqfa18dGtn8h1RAtPxZpMgb1k3oagtBWHW+IFsZKV9AQ3RINBDHcfEMt85AFA9NrjSbIO9HRbNL+W/ow02BiLPQbjd90apRmJWTodawA89daLJfsTcvKdoHN+U8F2pTj3FT+AErkO1UWHeEU9hm94j5eW+HYnxQfSrITzC3btX7oTxpJDAco+okoW1Fy5yXjWribhC38ibqkdXc7I26hBPZr/grYQqMvHnlOwk6Ym1tfQnibgpIQ5Fj8bsjoP6+fei8icMYjFarM57rag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zVCROPtaOXURz1M/u8CM81ujHE+/8G+QIBrd2aBFHnU=; b=Gns1bucUXUp3nRRPXd2Kqek8VQBfh5APrfCCSI043sX8ogRvtwK8+qUsEYrMqdIis5Zk6Cs/0l5p495rYtNAic7AXO2qzo/rmC7ZBoe6cZ7dbhxgLMqRfeVwBns7daev4OmilYRCf6IMd7+nhAMo3if87WBSRfgIe2G4fk+aoeih2ASYhyH8xvpIKTKpj+j2vRebzfEG7lcDCFZm3RIUEE+atfBa7aiU4pkQghRiyL/nM6NBfrGZrZTzjj8n/CrqUT5YnGuCxk/gvINgyeO3/6gCqSZqb9pGEKg+tUdlbdseqp4uU+mUwJilGIlrtgBR8YCe+JYvzWGliGYcFGwbdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zVCROPtaOXURz1M/u8CM81ujHE+/8G+QIBrd2aBFHnU=; b=JAq4N59M0EwsASRgW6E4Z7/ZA9JVAeQq6rcPL6+UPWm+MkT/oKslX+Ze8ie4QnKHXf5Q9p9QU7UOTI7l/56QHKZQ5H76RvXwOfqfgSDTX5Sx2r0zGiWlVAitnb4DFwBmSKy78788B9EZuwKQSGHNBvm1VhT/XRSRVwp7yXnqqsR4TX6DNxj4fAHgARLvuEs75iDDn+HGNXrI3gwnliQK1VzPckXAJTTDEIFnP3FJcl6xzHN2l1Wz9y9XjMOBITO/hSXCAJ3/1mf0HwXTkFe8bHVGTO/8OfKaQMN7baQqrp+aEPKJ6YEK5rpQeJcMq11lb0UocDBCPuSFtm9oc1foPA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) by MWHPR1201MB2542.namprd12.prod.outlook.com (2603:10b6:300:e8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.23; Sun, 10 Jul 2022 23:54:17 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::e9e9:810c:102b:c6e5]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::e9e9:810c:102b:c6e5%3]) with mapi id 15.20.5417.025; Sun, 10 Jul 2022 23:54:17 +0000 From: Benjamin Poirier To: Stephen Hemminger Cc: netdev@vger.kernel.org, Ido Schimmel , Roopa Prabhu , Paolo Abeni , David Ahern Subject: [PATCH iproute2 5/5] ip neigh: Fix memory leak when doing 'get' Date: Mon, 11 Jul 2022 08:52:54 +0900 Message-Id: <20220710235254.568878-6-bpoirier@nvidia.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220710235254.568878-1-bpoirier@nvidia.com> References: <20220710235254.568878-1-bpoirier@nvidia.com> X-ClientProxiedBy: TYBP286CA0002.JPNP286.PROD.OUTLOOK.COM (2603:1096:404:ce::14) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4fa98226-6b0f-4200-8032-08da62cf8026 X-MS-TrafficTypeDiagnostic: MWHPR1201MB2542:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ++S82Hm99JcQuPI0WdQS1hHepCEMOkcYe6ib9e69Eg/RahQMpIf03GOYTlaFtQWazRPZmmuHkmXtkGKy7qSvh1j7wDCExKYyV+JRPoGK9jy4rYCyuT1+KZrBkKxA1OyLw6OOD3pTkUpuFS5ThwxiDpktFHZdHjb05IiaCtpDaxGKmM8/7nefLzsD+LHYr+wU0uYVYbKMtGLa8tNJaxrO5aswM3nwG9FLtzBcaAxd1NK+I0ggOlymkZNaIu/yLlb9ov8HjJnjIH/1ZOOc1f49rxOUPpAPMwM42JJZnfvredD0WRDRqcF2CE1gznGWRRCQkMvGnoIfP6XdCX2Q7ZeB6ALmJHD9Lpw3lLbqWmdtYeO0vKbcyPfa8fcfIvLxDDVKeXz19tUt32GuS9apSkPF4N9j2Ia5xh6kd6Wr+1SQl34f5uPQAZhnsX11E02Mx91Do0qxoU0kt8efVNbMt4yiPvOc4BF4+zCSVd9Tw+VDj7C3rK+5Y7pdhVLUiD950iysByZugnB8WLUGUZ+Mtydd4WKynLA5Qj7mB9sUvpK01jQ42AnqBNX1ZkTZtIJb9FqTU8WoBQTjZns5t7FrD0/C0nsmMmDNBEgb2bEwdC62pDv6p6HzpDKsi5dL6O7phL5X8T6SzuoPt5BAumyebotpmpZl5l22SrFMhsO0UKklqpts7g2k3n64KMGRU4oMQDH6KFTK5bg2N4xbW0xJBobgy8d4zQNYjmwrhnd0e5yJt+eOoracKN63YuonpKkoss/l X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(39860400002)(396003)(136003)(376002)(346002)(366004)(186003)(66476007)(8676002)(66946007)(4326008)(66556008)(6666004)(1076003)(86362001)(6512007)(6506007)(478600001)(26005)(6486002)(41300700001)(2616005)(54906003)(6916009)(316002)(2906002)(38100700002)(36756003)(83380400001)(5660300002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cleIbi/585GZsQyWPiH1Jeuk/AF70uoSYUiUEhIe4e4h1fEFwoYk/SUvyTBQtdn2Yd7EpY6OSHHAMWPsKczCrU2JJKqaS84VTmULYbhtovr/TywJLzQwezMxkZdtMqOpbctoxG19l69ruAtthdqD2CNEgYfUo8jmkY4kxRzeUdZ0bmVIjhjlGZMnKX8k7rty8DT68PZHffWxe0JM9oEMka0b8UV/UtbNxzVzPhGKEb82UnJ6hwJVDsFQXAL7LneWJMRMLp96GKFNuy8xv+6U6o575Jasny2pEjeYJ6KZ8zYGBdzJMA/5n43N7DN1uWW05QVWzlzyFQ3Gd3fTVszOzwkGop6Lm77A4GLuBhGkzSmp0YaRJnJrtwBJUC/p0MY+Fskaq/hmdhsglsft//h11tj/VofqMpTK5CSUzoJhE1hWEyG4cjD7dfT22J8DumpdP7JoBXWXuqtDmeEV/XaKlZ1mg3h40XDndhjwKqyqIvxOcctKikL/nvlwag95CxXmWQh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ginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4fa98226-6b0f-4200-8032-08da62cf8026 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2022 23:54:17.5667 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bqKyOM4oFQ6aj316j7xsDSAsth5Jxeowzezv25bsFzTh2iB8bfbV+YU4cgovi9rNLaxnniS/ravyPyR5U/Bm0A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB2542 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com With the following command sequence: ip link add dummy0 type dummy ip neigh add 192.168.0.1 dev dummy0 ip neigh get 192.168.0.1 dev dummy0 when running the last command under valgrind, it reports 32,768 bytes in 1 blocks are definitely lost in loss record 2 of 2 at 0x483F7B5: malloc (vg_replace_malloc.c:381) by 0x17A0EC: rtnl_recvmsg (libnetlink.c:838) by 0x17A3D1: __rtnl_talk_iov.constprop.0 (libnetlink.c:1040) by 0x17B894: __rtnl_talk (libnetlink.c:1141) by 0x17B894: rtnl_talk (libnetlink.c:1147) by 0x12E49B: ipneigh_get (ipneigh.c:728) by 0x1174CB: do_cmd (ip.c:136) by 0x116F7C: main (ip.c:324) Free the answer obtained from rtnl_talk(). Fixes: 62842362370b ("ipneigh: neigh get support") Suggested-by: Ido Schimmel Reviewed-by: Ido Schimmel Signed-off-by: Benjamin Poirier --- ip/ipneigh.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ip/ipneigh.c b/ip/ipneigh.c index 7facc399..61b0a4a2 100644 --- a/ip/ipneigh.c +++ b/ip/ipneigh.c @@ -731,8 +731,10 @@ static int ipneigh_get(int argc, char **argv) ipneigh_reset_filter(0); if (print_neigh(answer, stdout) < 0) { fprintf(stderr, "An error :-)\n"); + free(answer); return -1; } + free(answer); return 0; }