From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 A93CE31716E; Tue, 5 May 2026 15:12:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777993937; cv=none; b=bDFmB9Ay4XPbg7nD+4NM0HTWZgnqvJZANI/JTCWdDwQt97yXMGteNsyhzIUSVX1lXvzMLdRKt9Prd1oN7DFa75cKC4mM5I02O1/EkRsD4I0fdpK4L1jtYowuVT++j/2RPp/7Ij8HGwRtqMLue11v/0QLlUdTTHsLUKuN3zr7b/U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777993937; c=relaxed/simple; bh=wS7Iyl4Ksq8TuCfTCVP/989EIkQJI5Y2q7NIRRFZvzY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=DDVZ7VYEydbJT1qXf9FMknGlLyFu8bhpMANpzNDYOiOq7LJkABe9l4vx1TvyqfUqND80rHeiN7CcHUtSmUxp/5Mmq4Vz++V0sdKtQEMIU0edTdqt07VRWhWHmHtUd/+3zTnmbM7nlfXo8wfnrfSKEY3uSyVXjsr/0scNdSraTag= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=KPox7L/h; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="KPox7L/h" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id E017DC5D73D; Tue, 5 May 2026 15:13:00 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id E54276053C; Tue, 5 May 2026 15:12:13 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id B797011AD02B3; Tue, 5 May 2026 17:12:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1777993933; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=27Qnd+ZboYtUoEDTDZ5XvOCVg1Pfk5BRU8+b+eKxg/c=; b=KPox7L/hOjw8e9BwBbS2GG+/A41j3+1C97H/i3XnNYZ6LkW/nofs0NoPLmmKXyZufKyJr9 BTN5SVTCeeh8RZ6U9SCAUfZoe0XRUYLQf5pmLU+SpQ9tvdBMyybaEk8pizblAM1YGdqR/O bRhQb/mMkAeViHfsdZdOju8+CfGBj04KUjbcPLET8lwBAYDlZZZs4nF3MIZsthw4cu3Dhq fbUOAiKq8FWKt7FatduA5iT3kGbT5zdYhC7aas9ema6zQBDiMNCOPIYaQ38pbxLhp87auf lYTHiY9gzRWP3FV8yZtqPYCWtLmK6Kdvt9MrTxZ9sUd69elI22jTww+IJ153NA== From: Miquel Raynal To: Lee Jones Cc: Valery Borovsky , Ben Dooks , Vincent Sanders , Andrew Morton , linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2] mfd: sm501: fix reference leak on failed device registration In-Reply-To: <20260505150013.GC2661693@google.com> (Lee Jones's message of "Tue, 5 May 2026 16:00:13 +0100") References: <6b4a9f5ae8a316b6f07f72f2fe3f0b8fc5f18dff.1777889235.git.vebohr@gmail.com> <20260504124841.443496-1-vebohr@gmail.com> <177790275684.156214.6563585281874262911.b4-ty@bootlin.com> <20260505150013.GC2661693@google.com> User-Agent: mu4e 1.12.7; emacs 30.2 Date: Tue, 05 May 2026 17:12:11 +0200 Message-ID: <87pl39oppw.fsf@bootlin.com> 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-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Hi Lee, On 05/05/2026 at 16:00:13 +01, Lee Jones wrote: > On Mon, 04 May 2026, Miquel Raynal wrote: > >> On Mon, 04 May 2026 15:48:41 +0300, Valery Borovsky wrote: >> > When platform_device_register() fails in sm501_register_device(), the >> > platform device allocated by sm501_create_subdev() has its struct devi= ce >> > initialized by device_initialize() inside platform_device_register(). = The >> > error path logs the error but returns without dropping the device refe= rence, >> > leaking the memory allocated by sm501_create_subdev(): >> >=20 >> > sm501_register_device() >> > -> platform_device_register(pdev) >> > -> device_initialize(&pdev->dev) /* kref =3D 1 */ >> > -> platform_device_add(pdev) /* fails */ >> > <- dev_err() called, kref still 1, sm501_device_release never call= ed >> >=20 >> > [...] >>=20 >> Applied to mtd/next, thanks! > > I think you misread the subject line. > >> [1/1] mfd: sm501: fix reference leak on failed device registration >> commit: faa9bba3fe2f37e7dcb26d4501d890fbfd7df160 >>=20 >> Patche(s) should be available on mtd/linux.git and will be >> part of the next PR (provided that no robot complains by then). > > Please remove this from your tree. It should be handled via M[F]D. Yes, it took a bit of time for me to receive my own answer so I replied to the original patch immediately stating that I dropped it. For some reason b4 applied this patch, whereas I was applying another m*t*d patch from apparently the same series (?). Both the contribution and b4 behaviour was strange. Sorry for the noise. Thanks, Miqu=C3=A8l