From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 942BE1BC46 for ; Sat, 31 Jan 2026 19:17:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769887081; cv=none; b=cMc3nNKz314nQa2qpRjuFq0SLQ64B9AHaionNy0EN3UhWzyRquXmPpIz+ZIx2ftj0xzxk+4zjSkX1XPXZbGE+7tHBJP1ZvmYvzcDZX5TtjDg97XChJa1uKx5vYHxAxrm/rJOP1GZZXvN2sx/jxByrK5vvsWP9LBXtMzyxVrBujU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769887081; c=relaxed/simple; bh=e/PfmY0FE7C+k2IGJX/fiRIBv+reifdPxa3dhe5Et6Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JKfEmmLhhM85BuTjC6iYutM4sN8JDJHfiPvKoEyK9F7Dpo6HCiz0r0x9ZzkFeg6ku49op+lMuJSYJkUsL54AMPMYIirqUwSz4syMenZ2GtyPy/XT728kmzbLxQOcHyjZ0zhDeasxGptvDgT3AtVH3gSDVIxTNMSE0e5pfqHus3M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=T4HGd38p; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="T4HGd38p" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-47fedb7c68dso33291315e9.2 for ; Sat, 31 Jan 2026 11:17:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769887078; x=1770491878; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=f2vXbp9S4vh8jrV4gBZZMI+qdSqhg08BiwZQDLQb1QY=; b=T4HGd38paX14AxxXHGwDbhOo5zalJt3hbr/JP6UkKcO/xvNOf8vt6WLn1oHc7uvxm8 JiSTw8BVfHjskMUc6cA0HibuaVkqIl3ZwelsjKfoofw5NYvhEENQbHx3pAKvIpcTeRwE 3iUyDUo0lu0v/6IYq6Dybd0o1aqg1SWU6E4oLOe2k96oPqZJoxZwcaIS2y7PwEQ9MJN9 hvTnbFP7SvERwY7BvFyzouRfL5RSve7QRAVZamoGgA0CyOnfIYyH4W39amuueEekGIf7 2yY5eyAJOca7vfyVVev2T2LA+I9xzjG/Vgt6IJfRMVj5+K1AYVRWwdnY6VaRiKGwTNSb XLEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769887078; x=1770491878; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=f2vXbp9S4vh8jrV4gBZZMI+qdSqhg08BiwZQDLQb1QY=; b=vmsccgpU8HII/J6MRNriln4whfR9R1W/2R2ZcmDhKT8iO1j5nqkmYgWDLjsXT+fUNc A7ioAAnUiHmLhWoKGqEdtoWAGuDDtk84KQtsE6TuWlGMzBLdkGvWGCiEO2CW3G0cKPAG nHTb4fTjHucoCe1E8PggXZmjzfUIZr/yd01uv8vgsk5x5oYYkkv7S4w6WAoFkXeFt1+C lgTTJPyNaugvuDo0dFwZUXiM1gF7wYPwDTusfMp50JHUtneOh2eKSda9nthp95JfcAYl G1shdr8LVYGMSHUBa5kCTrn0eRCj7LvBi88m122qCZejF5KuSI6DG7EvuEy0grQbgO9D P7yw== X-Forwarded-Encrypted: i=1; AJvYcCXdl3TcnX0NROSnwiultuN7WakUzhMnHBENPnHyD82W6avj/AJDknJAM7iugKnWGxO3tOje1UOtHitC1YA=@vger.kernel.org X-Gm-Message-State: AOJu0YztbpjHTyp1lkSQhKKqrayJLVJaTxsME90W7xrwhKP9ll72bBhF u1tS4iLt2iuznmnXjAnzxi14j98TsVWZSNODvbbBpvZdco0Ygt4YV6+n X-Gm-Gg: AZuq6aKvMoMlpW2v4X4yuhL+XobvnqapdsXzl43R6pVpp6fbAbx70shW5bBoCFhpE06 PPHvYIDpfBhtzPwcrCcoBcVq9vo53LZtfEQqDyRCaorQbd0P25gnWT7U0m3T2MgmtjK59FJzGFq tkHZZT+Luc50+5NpAAqbUs07+QATPTEg0pa2mx5qs7rB0eZiI/Om2oYsZbsLHtddw/gjvrjnvGp mEINSh+bIyMvcSvnyTKU4MSy9Ii69VdmKCTj1Ggl0yAfEPdG2u7S8XBfdkJnm/IyM609UURFXXm lqHm6w8BFMHeeAmbWdxn/35RsdxzkkhjqmZb2Y74273bXkkFWNAmXlHyWngjdmC+EZfzzWZzvaE sDfb+aWuaBe1Peo0R9jJsHcFqBjkdNT3BnnWymBK4IXCNUEtQzpIMD+6DfHYQvv8bbWOQD2nlKD IzZ8PgVWYDT0I= X-Received: by 2002:a05:600c:8b61:b0:46e:32dd:1b1a with SMTP id 5b1f17b1804b1-482db4567cbmr93509625e9.7.1769887077698; Sat, 31 Jan 2026 11:17:57 -0800 (PST) Received: from pc ([196.235.54.191]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48066be77b5sm328881815e9.2.2026.01.31.11.17.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Jan 2026 11:17:56 -0800 (PST) Date: Sat, 31 Jan 2026 20:17:53 +0100 From: Salah Triki To: Trond Myklebust Cc: Benjamin Coddington , Anna Schumaker , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] nfs: fix memory leak in nfs_sysfs_init if kset_register fails Message-ID: References: <20260131000937.229276-1-salah.triki@gmail.com> <9EF0F792-3B22-4A20-8A37-9C4B2236740C@hammerspace.com> <6d56e691114294ed3187e7a6f281c98293393a1a.camel@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6d56e691114294ed3187e7a6f281c98293393a1a.camel@kernel.org> On Sat, Jan 31, 2026 at 11:54:06AM -0500, Trond Myklebust wrote: > > If you take a look at kset_register(), you'll see that it does free the > kobj.name pointer if there is an error when adding the kobject. > > IOW: there is no bug in the current code. Thanks for the clarification. You're right, kset_register() already frees kobj.name on failure, and the kobject is not fully initialized at that point. I double-checked the error path in kset_register(), and the current cleanup in nfs_sysfs_init() is correct. Apologies for the noise — I'll drop this patch. Thanks for taking the time to explain. Salah