From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AD83A431D5 for ; Sun, 22 Oct 2023 16:31:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9CE4D410D5; Sun, 22 Oct 2023 16:31:45 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2044.outbound.protection.outlook.com [40.107.223.44]) by mails.dpdk.org (Postfix) with ESMTP id A380D4027E for ; Sun, 22 Oct 2023 16:31:44 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FKkRVUZAR7Zp8goOSgkz3Pav0Y/EOmg9TlbD6NLTfUm4Yk53NQJLMl8vvOX+ufan026M/FgiMvcmo4Z91FpmlZpuj1hQ74WVHEeAuy1Olar0aAIEU8An1fioeccf6MJe99Vo91cB6LmWUli6s1zhsVTwoXkO3gSkjCwNaPP86unU9bbrkqELeWYfVkktDRJtqeyLOqiF00xt2oPr0ivmfRpN3xvDK6cwPqEy2KohyygEhbI4AKJNN/Tmxskf8+l1QCl1TlRqscepPHkTE/Atyfa5Lq3tyw4iyx3dFihQeFFJ2BuHXzl/YpI/u4WjrFLeCLGCyiakz4LHFUTkVSDDUA== 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=a+KKo0Ywp3EwBKoqtzEUVCIwSM8rUs3MWAlVtLgwAmg=; b=EVL+g0Sps911DddBiMqbadCA9ET3FAHS6fvDdqq1Ibaen2AlFmmvnB0Ny0E9YzgpNvjsVzcA83CLI/dFyzD5+5OgZ7mZ4/ZdwpseIFcifwCcjO9nSaxuqsC2lW9t2uikeHA+BRdP+FZ/XXNNp8KmlZS1YswXKj19ji4vn/tc0bJU7TAuAqLFmoxcW+OFSoevpD4rSYNlgnsOUuujfmJVUqCZsUvXVXbQ6JeYpbUB84/i3TZ6SlDB5262M11jiO0bRMzpjPE2a1lBf3feSTkpkHYCD35eCVstCTSxilB2YHsW0NxfKmqURqHBuA45dEPFWRID30jruwMi42o3sdEHYg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=a+KKo0Ywp3EwBKoqtzEUVCIwSM8rUs3MWAlVtLgwAmg=; b=B3yfKAPZ31n+eroB/OSFJaefFyyqD7pL7MYHpWZf2tbR3aJvncTQystL9BwsGJ4WfvRlZ4yHPxj6ogJQ832ysGQ70cqZCGVvDSrBmrxMQKsRVJbNPxj1/9eUwP7GzIsrdJ/ZBkd6AEOaxZU9iuhL6bhceOAYevchqys89UJrcTUifzEXOjpnB1YX5A2yPVhlDcRbEONPs821tVyklHBOsp6q4JY4EfFK4woSVFZ15qtPlw/lUI7hF8sAZj0clqMjnOlccsOm/GdbDj9V9ODsl/HqurKoxP6fLmrEtdfJQDq/iR0p5jLDTPXD9htTb4ClwNeGlI873RsaYBj1OihWcA== Received: from BLAPR03CA0104.namprd03.prod.outlook.com (2603:10b6:208:32a::19) by DM6PR12MB4912.namprd12.prod.outlook.com (2603:10b6:5:20b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.26; Sun, 22 Oct 2023 14:31:38 +0000 Received: from BL02EPF0001A0FB.namprd03.prod.outlook.com (2603:10b6:208:32a:cafe::1) by BLAPR03CA0104.outlook.office365.com (2603:10b6:208:32a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33 via Frontend Transport; Sun, 22 Oct 2023 14:31:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL02EPF0001A0FB.mail.protection.outlook.com (10.167.242.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.15 via Frontend Transport; Sun, 22 Oct 2023 14:31:38 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 22 Oct 2023 07:31:28 -0700 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 22 Oct 2023 07:31:26 -0700 From: Xueming Li To: David Marchand CC: Viacheslav Ovsiienko , dpdk stable Subject: patch 'net/mlx5: fix leak in sysfs port name translation' has been queued to stable release 22.11.4 Date: Sun, 22 Oct 2023 22:22:08 +0800 Message-ID: <20231022142250.10324-100-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231022142250.10324-1-xuemingl@nvidia.com> References: <20231022142250.10324-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0001A0FB:EE_|DM6PR12MB4912:EE_ X-MS-Office365-Filtering-Correlation-Id: 9723c3a4-9b04-44f6-2db9-08dbd30b9a34 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RXpilv383XDuVvD/OsdOKZn07Tr+eVpXIZkmrvpeUs8Pi0+fKk/cFWQKkdmGW6NlO5GjbKpWa9K2FoyPejFgnDoq9Jko4R6AWw49bHVxeJOJp1NVY30UhoD4KfZ9jKNGebmRWYNNXvwb24SFEMNoK5xRKG77R0isHvWXa1BPXpB+rhoOW4iFvemyupOCHOYYzcgmvszR9ZG0yTeUhNWKCh6cIj1Eh+w4CM16VuEc4yLBdAc6WeCRXY1RwTd0ACdbrp692oHLWUo6pNA2bhFeuBjcf3sUZy0l8HgppN38mymdpqC1IHqSZg+u2FnpuH0R8iERtPglNpJKzSwcuHzoaoiAMOS4KvPXqCu9MGx99b0GFk1Qr/DejE3KvrwgU7QqMWT3heauBgGCMuQsx4/vwDH/B20SB+5UfImy5IYtIfrBXR7CGo/CrD5G1C/VG6wdKeKSnJxovxj8VwI4aLXCv025cuybjMa8KGjBiV/NHqnt/1VsL30SNe6p6A6HFT83hFxU+nUWLd6I6PwKcN7KJZcZ/LtlHP2P18tZncz/6m1SVkE+EjdcLq5KxJZ+ptT2PutWMl+dYKORuFUY7IDwWD5Ejt5KzF1QhvLaoIxfPn7ZzZml5yP6+db8dlGXNsq+wf/IRtb/5EBJdKNvvKOGXBZxQAsToRBLXVq3XS/pOsvHV22uLl35baHlTKeFwaFyAOyOB9OzaV6nu8uQqM4HnkgJt3yFtzkUEyvc47z6U1cuIujUF8f4mdm1g+VeoTZsqT6xyvYFc3IgvS1a4eKjQg== X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230031)(4636009)(376002)(396003)(136003)(39850400004)(346002)(230922051799003)(186009)(64100799003)(82310400011)(1800799009)(451199024)(46966006)(40470700004)(36840700001)(55016003)(40460700003)(36860700001)(6666004)(336012)(4326008)(83380400001)(8676002)(5660300002)(426003)(8936002)(41300700001)(7696005)(6286002)(26005)(47076005)(2906002)(53546011)(16526019)(2616005)(1076003)(40480700001)(86362001)(36756003)(4001150100001)(316002)(54906003)(70206006)(70586007)(6916009)(356005)(478600001)(82740400003)(966005)(7636003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2023 14:31:38.6081 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9723c3a4-9b04-44f6-2db9-08dbd30b9a34 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0001A0FB.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4912 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 22.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/15/23. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=22.11-staging&id=8115fe334542f8dba41a55f20aa20e08de71d20a Thanks. Xueming Li --- >From 8115fe334542f8dba41a55f20aa20e08de71d20a Mon Sep 17 00:00:00 2001 From: David Marchand Date: Tue, 1 Aug 2023 17:18:31 +0200 Subject: [PATCH] net/mlx5: fix leak in sysfs port name translation Cc: Xueming Li [ upstream commit 1296e8d0d0fe74646fbb0339969cf3946f1ce84d ] getline() may allocate a buffer even though it returns -1: """ If *lineptr is set to NULL before the call, then getline() will allocate a buffer for storing the line. This buffer should be freed by the user program even if getline() failed. """ This leak has been observed on a RHEL8 system with two CX5 PF devices (no VFs). ASan reports: ==8899==ERROR: LeakSanitizer: detected memory leaks Direct leak of 120 byte(s) in 1 object(s) allocated from: #0 0x7fe58576aba8 in __interceptor_malloc (/lib64/libasan.so.5+0xefba8) #1 0x7fe583e866b2 in __getdelim (/lib64/libc.so.6+0x886b2) #2 0x327bd23 in mlx5_sysfs_switch_info ../drivers/net/mlx5/linux/mlx5_ethdev_os.c:1084 #3 0x3271f86 in mlx5_os_pci_probe_pf ../drivers/net/mlx5/linux/mlx5_os.c:2282 #4 0x3273c83 in mlx5_os_pci_probe ../drivers/net/mlx5/linux/mlx5_os.c:2497 #5 0x327475f in mlx5_os_net_probe ../drivers/net/mlx5/linux/mlx5_os.c:2578 #6 0xc6eac7 in drivers_probe ../drivers/common/mlx5/mlx5_common.c:937 #7 0xc6f150 in mlx5_common_dev_probe ../drivers/common/mlx5/mlx5_common.c:1027 #8 0xc8ef80 in mlx5_common_pci_probe ../drivers/common/mlx5/mlx5_common_pci.c:168 #9 0xc21b67 in rte_pci_probe_one_driver ../drivers/bus/pci/pci_common.c:312 #10 0xc2224c in pci_probe_all_drivers ../drivers/bus/pci/pci_common.c:396 #11 0xc222f4 in pci_probe ../drivers/bus/pci/pci_common.c:423 #12 0xb71fff in rte_bus_probe ../lib/eal/common/eal_common_bus.c:78 #13 0xbe6888 in rte_eal_init ../lib/eal/linux/eal.c:1300 #14 0x5ec717 in main ../app/test-pmd/testpmd.c:4515 #15 0x7fe583e38d84 in __libc_start_main (/lib64/libc.so.6+0x3ad84) As far as why getline() errors, strace gives a hint: 8516 openat(AT_FDCWD, "/sys/class/net/enp130s0f0/phys_port_name", O_RDONLY) = 34 8516 fstat(34, {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0 8516 read(34, 0x621000098900, 4096) = -1 EOPNOTSUPP (Operation not supported) Fixes: f8a226ed65fa ("net/mlx5: fix sysfs port name translation") Signed-off-by: David Marchand Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/linux/mlx5_ethdev_os.c index 639e629fe4..dd5a0c546d 100644 --- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c +++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c @@ -1083,6 +1083,7 @@ mlx5_sysfs_switch_info(unsigned int ifindex, struct mlx5_switch_info *info) line_size = getline(&port_name, &port_name_size, file); if (line_size < 0) { + free(port_name); fclose(file); rte_errno = errno; return -rte_errno; -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-10-22 22:17:38.002026700 +0800 +++ 0099-net-mlx5-fix-leak-in-sysfs-port-name-translation.patch 2023-10-22 22:17:34.366723700 +0800 @@ -1 +1 @@ -From 1296e8d0d0fe74646fbb0339969cf3946f1ce84d Mon Sep 17 00:00:00 2001 +From 8115fe334542f8dba41a55f20aa20e08de71d20a Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 1296e8d0d0fe74646fbb0339969cf3946f1ce84d ] @@ -55 +57,0 @@ -Cc: stable@dpdk.org