From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796375437; b=xlYz0i72i5WtA8qeDQ2nafJTQCpBF2H6Zfdrzc3bdacIbltc7GYS3zuBSUPtsyQvXpcv 4//jZcNREtMgCfKH+x2I1Fc3H1J3XrbMo2FbCJNvXjj4yvTn2Efuq/qd57LSxk7hEWSYc A7lCnQ9dZWnjhYEYaNOTvgsAn4u7FZNy7mUN/JKMqRbhk44U1yVjgCZkZ0zHVU6IG2btv yFOVKIwYqZAg+cu5sDKWzu8yq2l+4TOjSL/pvRdx1rFMpcnK+PiWo7Qh0aqFKrFeONrAS uxk8OeVti9fiJdZxnqumtnuEDLJOuNhRDBp4vOLYWPKBR1QdMOPJ58v5T9IfeO+gT6g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796375437; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=tNbBIcIP9IYY2RJpB6BQk4Kk0PgAgLcuDXzeSrRWLxo=; b=AYfQ3bcZNarzhB6Cvo775i6Dy+oUm1evhvc+KpEVouLlg9pkZ0bfhueCpw7hz1EbAdLr /IWtyLk2I3AvYRuKlkTlx2HRbhxMptM4Z5lhbVE1TI+eIOf/L2Jutx3xy6yGfF2GeGaRa AfPsEJPBM5qS3ulNLrIeSZjtg5w1oLh6kKf0iCOrS1lZXf8wInTmMsklQXtNO+heE6YGH vVOhGcrqSX5slHyqcbFrXjK5tph8DzNsyVfkVdOWBOl1eroYYpwiWdrGd6bxLwxia9OOR Za8GHXRkUnt2rg7ZCtwFjfxB/T18dx+62CdX+7PcqH0ndu2n2rLJeCq0l8QCR6HzS4g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=hV7xfHZM; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 751C7606A333; Fri, 4 Dec 2026 09:10:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=hV7xfHZM Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D44A1F000CE; Fri, 4 Dec 2026 09:10:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796375437; bh=tNbBIcIP9IYY2RJpB6BQk4Kk0PgAgLcuDXzeSrRWLxo=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=hV7xfHZM4oZ/KUqZfEGs7CoARl9MxMK1KAQj/gOIagCd8DGA9pyLfHOzpfKAKv6Ri yBU0abZ2hHlbAlsH0F9LS8q9NSys3y40TLF2ciGXERo4xj2WyTGKlzcBmEIEy4aT+q 8psjcaavCIk/fyZlFv1vaUpmOwrlBN97bF/Bd26Y= Date: Fri, 4 Dec 2026 18:03:22 +0900 From: Greg Kroah-Hartman To: arina.kharlamova@mbzuai.ac.ae Cc: Pali =?iso-8859-1?Q?Roh=E1r?= , Jiri Slaby , Gregory CLEMENT , Wilson Ding , Miquel Raynal , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: Re: [PATCH v2] serial: mvebu-uart: do not leave a stale port behind when probe fails Message-ID: <2026120401-annually-amply-455c@gregkh> References: <20261203-v08b-v2-1-79564cfdbb46@mbzuai.ac.ae> X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261203-v08b-v2-1-79564cfdbb46@mbzuai.ac.ae> On Thu, Dec 03, 2026 at 03:11:44PM +0400, Arina Kharlamova via B4 Relay wrote: > From: Arina Kharlamova > > mvebu_uart_probe() fills the static mvebu_uart_ports[] entry with the > devm mapping and the devm private data before it gets the clock and > the interrupts, and keeps them if uart_add_one_port() fails. On any of > these failures devres unmaps the registers and frees the private data, > but the static port keeps membase, mapbase and private_data. > > mvebu_uart_console_setup() only checks membase and mapbase. When > another port registers the console first, for example with > console=ttyMV1 and ttyMV1 still waiting for its clock, the setup > callback uses the stale port, accesses the unmapped registers and > dereferences the freed private data. > > Keep the mapping in a local variable, test is_ext through mvuart > instead of the port, and store membase, mapbase and private_data in > the port only after the last step that can fail before > uart_add_one_port(). Clear them again if uart_add_one_port() fails. > > Fixes: 30530791a7a0 ("serial: mvebu-uart: initial support for Armada-3700 serial port") > Signed-off-by: Arina Kharlamova > --- Does not apply to the tty-next branch. Can you rebase and resend? thanks, greg k-h