Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp527944lqt; Thu, 6 Jun 2024 10:13:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXzodStCFnZfdE7/1v70tp7PlrWUNJsqotm/jPmBqzfLQwME4KdCqLRkYn1v7KOpdCnufsb0+UugmFhqvSb/M/05vZS4iDV4b3OtayqzA== X-Google-Smtp-Source: AGHT+IEppJmuZcBLy01xVgwl+4FxDVjp4/fOSSxqmn+PkaQng9iwOvLP4Rtqodp8BSsi2ljYAhhf X-Received: by 2002:a17:902:c145:b0:1f6:6ad1:fdf9 with SMTP id d9443c01a7336-1f6d039b757mr2253835ad.57.1717694014674; Thu, 06 Jun 2024 10:13:34 -0700 (PDT) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f6bd7608d8si14842485ad.18.2024.06.06.10.13.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 10:13:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204729-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="cqR/sAsb"; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-204729-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204729-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 18A4E28D863 for ; Thu, 6 Jun 2024 16:49:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 036EB198E81; Thu, 6 Jun 2024 16:49:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="cqR/sAsb" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DDA1198E60 for ; Thu, 6 Jun 2024 16:49:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=192.198.163.8 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717692577; cv=fail; b=be/hwRPboNyzasHGnLU92Mz6k9iNB9s3hZ1Fj2s4UeEJ5Nr91SPSqqL2OUQqWu2K+sbH9PQZhacyTwflPb85WqnBh8uzsOPchucQsUS0R++XsBMfDwCMLyJENsWP02m+7SkbZfA8jdOnvGw+tc+KsVS66QHt3B2oW7cujryMbsA= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717692577; c=relaxed/simple; bh=pG4jrkflHN5PSnG5w/dqhZI8x7RjRVjw9JvF42pyKDs=; h=Date:From:To:CC:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=l0+dqU6vbfbAn7cF+8d6hGnJY/3PMwS2Sgokcxv6DZidKCDlVVFm/SmYYpmKwlYlCH73xB26DAOn8bFntWzBPfXSCXE9Jcrcqfgum35Z8Un2mVv3lRStIX6RZyU0g+hVV+oxgFSdj70LAE+33s9yz+qgmDcXo8MyOO5b3mG5xUk= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=cqR/sAsb; arc=fail smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717692575; x=1749228575; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=pG4jrkflHN5PSnG5w/dqhZI8x7RjRVjw9JvF42pyKDs=; b=cqR/sAsb4uaZcK/Z+e/amfuKwsF8AL4xV+dE5B/CV83T93ddcaEJOj9P PccvvtAhq1abV5n57dIX4fXKduQWDq3qEsxhIomV64tZeaTMPGIMqbsAG pRKqbCYAeYzuE1imEk+3+vrWyFZF8oWAjS8XLcQ+7PuGnrSYQCoYyVL1i sl1748/fm4lViJoqSvQCUiPw/Sy7elc93Aa9kgDFBsSjidHCpXv/CiT/j DPaY1vNeHkz/3zLJnl8G1Ensd9l8qGb9/nzO8qzPAJGLRidIWmk2vp7V8 fdfM54CKlmbao0MlmT92zJFU7tFIrsbyBA7dmz+UuvLmV3vWGvlu1vdlz w==; X-CSE-ConnectionGUID: YrIQZmGiT0iPlv8XiSoa2A== X-CSE-MsgGUID: hJ+3uwzMTsW1p+IWZ18rAw== X-IronPort-AV: E=McAfee;i="6600,9927,11095"; a="31923576" X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="31923576" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2024 09:49:35 -0700 X-CSE-ConnectionGUID: X8csKomVQs+jVm5RGXgo2g== X-CSE-MsgGUID: bQbOTc60TWqcks0oJzEIXA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="43120117" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orviesa004.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 06 Jun 2024 09:49:34 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 6 Jun 2024 09:49:34 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 6 Jun 2024 09:49:34 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Thu, 6 Jun 2024 09:49:34 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.47) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Thu, 6 Jun 2024 09:49:33 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Oiuln+XeQwZBmFNr9mqfMaPDMAXLeAunU96qMLqzdE8GaSB4Fz7X0zVvlYhWzgej6qGgqqaWkEjZBQjkWu5RXWi+jiNMXqTe+Ff393RyFc8PLY/UXCgmboDSBdiQt/BAmKVDM7//cs6LFdfsQBnkSgm5jFM/GpnY34ww6Ra6l5MxOxfXaUfm+l7+pIVGLtlQhlk7w5cUDEFBU/Gfv8qEdDXGHE27It48JMBx0rEbS/n+ulr/0am+sChuMIuJLSzXrrCvhc4bKDfTS/ymjzGp0VOsynfwNYKDOuzp5jeqiXgrLig1QZf2d6fCthuuMp2iIuziIy5xtvYL6EFdILPVCw== 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=uYTPBaQ5Vlq957sj+QVaKk3Vvcd0SKV+qO87gR+E92k=; b=OzYwA4PBPlxrZpAxV/m6cGXNwZo6jqa9cLYwCtRfwUXILiE86xJyDGURIFq2YyLe9Jj26yRshGT+5L9K2ceFrg4yyzZROkogr2KS2cj+eOPlNVBL4Equ1/UuH1rkKSqezPxSYgGzlztM/2XcvKUhncT4ik/yIqJDwzuKgkqB8/VSJhD8EJaXkGsvEJI1zlerIH7XJICZq0YzKqDc5Z6Js0pr5UVPzeydpWXjykUuHH1octYvXz4ifyFFame/JVhqNwEtDv7bAfnH8xmpaUB/C2kQX1wnhTFyiEgJbffXSV+mTK+P3iB8wyJ3Ox0PYq1DSrOO0Ylrhjm26pMaHIADKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from SA1PR11MB6733.namprd11.prod.outlook.com (2603:10b6:806:25c::17) by MN0PR11MB6205.namprd11.prod.outlook.com (2603:10b6:208:3c7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.27; Thu, 6 Jun 2024 16:49:32 +0000 Received: from SA1PR11MB6733.namprd11.prod.outlook.com ([fe80::cf7d:9363:38f4:8c57]) by SA1PR11MB6733.namprd11.prod.outlook.com ([fe80::cf7d:9363:38f4:8c57%5]) with mapi id 15.20.7633.033; Thu, 6 Jun 2024 16:49:32 +0000 Date: Thu, 6 Jun 2024 11:49:27 -0500 From: Ira Weiny To: Li Zhijian , CC: , , , , , Li Zhijian Subject: Re: [PATCH] nvdimm: Fix devs leaks in scan_labels() Message-ID: <6661e897cfd4c_16ff40294f@iweiny-mobl.notmuch> References: <20240604031658.951493-1-lizhijian@fujitsu.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20240604031658.951493-1-lizhijian@fujitsu.com> X-ClientProxiedBy: SJ0PR05CA0062.namprd05.prod.outlook.com (2603:10b6:a03:332::7) To SA1PR11MB6733.namprd11.prod.outlook.com (2603:10b6:806:25c::17) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA1PR11MB6733:EE_|MN0PR11MB6205:EE_ X-MS-Office365-Filtering-Correlation-Id: df047e8b-01b6-4f95-256c-08dc8648a371 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|376005|1800799015; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?sJhT0gyh3kQ8qcWhCeTSRfQLQK8E1i2HlvBUtS9qNuqPjONy2SglMQOlQTow?= =?us-ascii?Q?6Zt5Ajl35bM6YOzdG1JyJyT6pO7k9RIf4yVbyK/Vs+hdCIaYNRVufStKX018?= =?us-ascii?Q?Z0wf2w3Bfs5U7hE1K787ODKkeT+dIzfraKptTT9ZCf6mUeAFloOpfAJSVadT?= =?us-ascii?Q?Vi9tdcJwGSxkrKcuKHsSbJsA0jSTMdSkhuGNq72+PjuYZJU/EcVqRqgbPSV3?= =?us-ascii?Q?OUesMuUQP3/wCDnlfxTWpt8bQXnYi01v+UciA3l4zujLq6fU9W8YD7bUjuvU?= =?us-ascii?Q?D1X2TkOfIWSD525RgYKc/xuSOjby51cA2fCQEa5avCYs8gHkl5c55LjR/poU?= =?us-ascii?Q?UuZtC0Z6L4Iom65LFj2McXsEk32AAXgh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sSBOvVIAM7drzlWLfIztrlRRgVqaPlU/fdUGDyRbC+9RKkHyTRWKjjMXq?= =?us-ascii?Q?S3o4z4IB0pG+m5sC7cwJ9ZBc?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR11MB6733.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(376005)(1800799015);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?86/q4c7guSnuRSIFYn5WA+fNYkUzLYmEOP05102MndRI7DEos9sCvGaE1KNr?= =?us-ascii?Q?w52KfewCyXfcYSQs12c9sCPbh3glKfDlem+q6m49DR48tin2o0oLmafVNmas?= =?us-ascii?Q?odivTohI6nALIlwu6s49xVDZ0tuL9LBiEt+9vGUUju8VQkgXeeaNOtxCixH/?= =?us-ascii?Q?psUpd+N/T6g0eUnZNaSElfVkOOH1mnCZNlKSlpkfPwbfDmanMa2FklSbJ+tB?= =?us-ascii?Q?MLPr9KB2K4faOz526PzVmUbwUCscP4pGgkReQIdRQm/Ga8mtxIZe8rg/rLJF?= =?us-ascii?Q?eREJeP6FV6gsXIZuxF82xhu6UTSDkJmX4jTdD+ruejvF0y9DngcFXyuyoI9x?= =?us-ascii?Q?++e6es4oCbiEicrgSidelyNnktsRZbEz6ZH/z7iDQTn24KSpDKbESBU+3cey?= =?us-ascii?Q?RGqamHZuwyqlAwFo2CbTC5Rh+UMfNpuUpPnBC3syzWvQCvAQJpKcnu0zWfkr?= =?us-ascii?Q?lF8YnnN6jiDWKydNtK9XnxhMQrfn3JvgAtDX9gceIAmYJ73IyleLKWf/kQj2?= =?us-ascii?Q?z2OgQj71lOUTGG5GR1p6AWAu7t5GRGl0hT3v11RmCYoa62woQEIOQ6UEjo1w?= =?us-ascii?Q?5hCgUIymbD0Dgg4Xi4zEz8zZOMRVWbVUg6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-ascii?Q?9yULNjbbv9gm/E64pCnK8SFzMVLxnP2ifEja/mKWyY+N7/z23B9+lb7+arZM?= =?us-ascii?Q?j++/0PlJzulZh+vHPyr9QkUDHlWIv3/5rVm0ESkp?= X-MS-Exchange-CrossTenant-Network-Message-Id: df047e8b-01b6-4f95-256c-08dc8648a371 X-MS-Exchange-CrossTenant-AuthSource: SA1PR11MB6733.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2024 16:49:31.9467 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uPTYitgTprMt9rJj7Ttvxt4IeCS4QNPl0ERVySMaUiDsdZxU94wfIewpb6EfgF8jnNmxlGPeLT4P1PbeLHywpQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR11MB6205 X-OriginatorOrg: intel.com Li Zhijian wrote: > Don't allocate devs again when it's valid pointer which has pionted to > the memory allocated above with size (count + 2 * sizeof(dev)). > > A kmemleak reports: > unreferenced object 0xffff88800dda1980 (size 16): > comm "kworker/u10:5", pid 69, jiffies 4294671781 > hex dump (first 16 bytes): > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ > backtrace (crc 0): > [<00000000c5dea560>] __kmalloc+0x32c/0x470 > [<000000009ed43c83>] nd_region_register_namespaces+0x6fb/0x1120 [libnvdimm] > [<000000000e07a65c>] nd_region_probe+0xfe/0x210 [libnvdimm] > [<000000007b79ce5f>] nvdimm_bus_probe+0x7a/0x1e0 [libnvdimm] > [<00000000a5f3da2e>] really_probe+0xc6/0x390 > [<00000000129e2a69>] __driver_probe_device+0x78/0x150 > [<000000002dfed28b>] driver_probe_device+0x1e/0x90 > [<00000000e7048de2>] __device_attach_driver+0x85/0x110 > [<0000000032dca295>] bus_for_each_drv+0x85/0xe0 > [<00000000391c5a7d>] __device_attach+0xbe/0x1e0 > [<0000000026dabec0>] bus_probe_device+0x94/0xb0 > [<00000000c590d936>] device_add+0x656/0x870 > [<000000003d69bfaa>] nd_async_device_register+0xe/0x50 [libnvdimm] > [<000000003f4c52a4>] async_run_entry_fn+0x2e/0x110 > [<00000000e201f4b0>] process_one_work+0x1ee/0x600 > [<000000006d90d5a9>] worker_thread+0x183/0x350 > > Fixes: 1b40e09a1232 ("libnvdimm: blk labels and namespace instantiation") > Signed-off-by: Li Zhijian > --- > drivers/nvdimm/namespace_devs.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c > index d6d558f94d6b..56b016dbe307 100644 > --- a/drivers/nvdimm/namespace_devs.c > +++ b/drivers/nvdimm/namespace_devs.c > @@ -1994,7 +1994,9 @@ static struct device **scan_labels(struct nd_region *nd_region) > /* Publish a zero-sized namespace for userspace to configure. */ > nd_mapping_free_labels(nd_mapping); > > - devs = kcalloc(2, sizeof(dev), GFP_KERNEL); > + /* devs probably has been allocated */ I don't think this is where the bug is. The loop above is processing the known labels and should exit with a count > 0 if devs is not NULL. From what I can tell create_namespace_pmem() must be returning EAGAIN which leaves devs allocated but fails to increment count. Thus there are no valid labels but devs was not free'ed. Can you trace the error you are seeing a bit more to see if this is the case? Thanks, Ira > + if (!devs) > + devs = kcalloc(2, sizeof(dev), GFP_KERNEL); > if (!devs) > goto err; > > -- > 2.29.2 >