From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 BD8223E5EE1 for ; Tue, 9 Jun 2026 07:56:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780991770; cv=none; b=fwhAGqJrmRlazFYPGKBT/NHMA50hyRlDggMuxPoDkS7+HpwNX7HQTvsUQroQUxJ8Fc9grOLo9mScQ+AuRTA5Tf/6A6H2Tc1/3ynMG2FoPspuDrwBnSxgqBYjlXoTGPL8RFvx4wUV5Q1aSCYskEMUXy1XtI1TQSbXlYetYYrC+DA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780991770; c=relaxed/simple; bh=mb2dnBD/xPkozFuDbis7Gifd5+A09teiekEygmEENbI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=L1kBotCKawzzYU0itry46FW7kZGQmpPxQTDaRd5/T8uhI/sNze/XAYpLC1oqGAkZChrBX/jsBLAzS8lA3N5DIs7aQMuPNaPQgmuU6DyvJtYFTc55XoGaaZbiHZef5rfBEz0VTWfAKUS7jHJGZrvkIR1nmgFEKhHx/D/67J7rfoo= 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=F6rMLRwG; arc=none smtp.client-ip=185.246.85.4 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="F6rMLRwG" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 403C44E42C88; Tue, 9 Jun 2026 07:56:07 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 141BC5FFC1; Tue, 9 Jun 2026 07:56:07 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 4C848106A2A14; Tue, 9 Jun 2026 09:56:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1780991766; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=mb2dnBD/xPkozFuDbis7Gifd5+A09teiekEygmEENbI=; b=F6rMLRwG1YGHPPHFu9Lkx5C31IrPBfKdAcVAUBj09KvhQX6xzbD3xkD9TBKq0bckwxrOCH zQFnVY6up6wpHX0N1aZnFjKF3swYVLlX+BwY4zyeYs8VSf0Pce3nM32RMMrcKXDa36jqkX thikqIrO/jhZqCV6A+BFsSdGbQy/yqqrD4tOC/pLkvkEtSkLLWRu/DX8i0BUpGCvUmjuPZ 5dexYKlSEKIrFVL/rgmty7T9O6WjxFoBHq+fqvQwEY4jW/74tbBZuV/+663LaVoVRvbS0S EQhGBfSpP75Gyky0dlWIjb+LSmUADQMk9K0P4dsNT3v2U+2UQvx32jMumKnDsQ== From: Miquel Raynal To: Ruoyu Wang Cc: Richard Weinberger , Vignesh Raghavendra , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mtd: slram: avoid dangling device list entries In-Reply-To: <20260608162939.6-1-ruoyuw560@gmail.com> (Ruoyu Wang's message of "Tue, 9 Jun 2026 00:29:39 +0800") References: <20260608162939.6-1-ruoyuw560@gmail.com> User-Agent: mu4e 1.12.7; emacs 30.2 Date: Tue, 09 Jun 2026 09:56:04 +0200 Message-ID: <87h5ncb10r.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 Hello Ruoyu, On 09/06/2026 at 00:29:39 +08, Ruoyu Wang wrote: > register_device() links a new slram_mtdlist entry before the entry is > fully initialized. If a later allocation, memremap(), or > mtd_device_register() fails, the failed entry can remain reachable from > the global list and later cleanup can dereference or free invalid state. > > Build the new entry off-list, unwind partial initialization locally on > failure, and only publish the entry after mtd_device_register() > succeeds. > > Signed-off-by: Ruoyu Wang I am sorry but I cannot take this patch as-is because it does way more than what you claim. It makes a lot of cleanup changes which are totally unrelated (yet welcome). Please create a series with: - the fix (that can be backported) first, with Cc: stable and Fixes: tags - all the cleanups you want to do after. Thanks, Miqu=C3=A8l