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=1796229640; b=jsoceFJeNC95jvuSRkSFrG5h2Qc+HMMnoL9RaGLM+ZYbGK4iNnVPY6OAEakGeApbuiHd fMPO6mKSbAm2RL2Ib99qNET4C/oWHxdagvHhB+m7P6HCADeUBnhTLxaYVhJ5F+ZtvD53F w3Z4hmE8fVSMmLZgpww8/+UmhALmZ1zFg0BrX0BjYBE6Bd+FgCw8DPy41+BdCu8wNSt2+ 4nWas0DBICwsHUbEi1U7/qsd53ZRPKlv3Qjh6WVSMKf5ROtAPFKvU0mQJLviqazKKrqz7 D0j2EsM3LpwUAWSlbc/g/M51jzrHOiN+3axJbIYwPWvq3n6WmG9h9+yE1byLypJeI0Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796229640; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=t2qyAMhpZUNTiUKASEatT8P1Ww497vjHHW8xfpfeOE0=; b=Y+Ffn1owiri1e2iKWaVjiwfaEAHK/sYt3J6PeMBXM7sL0uPFyBB/zj6Q6FWXtM2+X1Z2 zCa5maTEJNqnWkZsX2BrujHnlAHxvvpo9kkTHley6dN1TQ9+JcaU8mrJY9VEI7KI9lBpw +IhaaywugZOnNyNAa3VKfzmdDrWtTOeEe1/X97MOvdHSLQgfr69+F7k1JCJsLUuhUj8Ip zaow0edUXKpU49e84JLtrDblUhWiXVh8W4hxNhu/INpedZ8oL+lDnRagdaY2sMZruaBx0 ocYeDIRvAyMAZuBXQN9lgAmQLVOTfmpdF8zf0dgrQfN2U8pHgFDyw9CI+N2KW2MntlA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LZ1ttuIN; 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 A4A63606A329 for ; Wed, 2 Dec 2026 16:40:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LZ1ttuIN Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E5071F000C1; Wed, 2 Dec 2026 16:40:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796229640; bh=t2qyAMhpZUNTiUKASEatT8P1Ww497vjHHW8xfpfeOE0=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=LZ1ttuIN+ojKJ9KIkMhzfIS/nMxyk9nxXiT7xppM4nS5/PRWCXnSuCeUGIeKlWdvs ANXLMuZIDPMmRhC/kWyq/ebrPg7c2F+Hx4CkCP37BWcS1JxSo+cxyqOpHYGr8+MC33 EAZt9w01c4fV8S4D0Dmamcb6HIfsZ2n8K0d6oNrvjeoa5aBCgixaLV+u57DKIAjhzA 8jLcLyJnuko0CQ8G1M1JPtMRgSjdXwnYu5KdwJnVlt0dzWrQbPgMGV/k+trCkTSEP4 3++JU/HyNIM7R/+uv+2EKm5eu5MSASEAAKf0A/YHB4yOEj043aZKXArqrN22fLH1t2 o197CfKTUva+g== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] serial: max310x: simplify clock management with devm_clk_get_optional_enabled() Reply-To: sashiko-reviews@lists.linux.dev To: "Hugo Villeneuve" Cc: linux-serial@vger.kernel.org In-Reply-To: <20261202162824.34779-1-hugo@hugovil.com> References: <20261202162824.34779-1-hugo@hugovil.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 16:40:39 +0000 X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [Critical] serial: max310x: use-after-free in max310x_remove() [1] -- commit b2a072021bb98e40adfb8c4e05317de478392670 Author: Hugo Villeneuve serial: max310x: simplify clock management with devm_clk_get_optional_enabl= ed() This commit replaces devm_clk_get_optional() and manual clock enable and disable calls with devm_clk_get_optional_enabled(). > diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c > index de8a1f05cf30e..8a71127c29210 100644 > --- a/drivers/tty/serial/max310x.c > +++ b/drivers/tty/serial/max310x.c [ ... ] > @@ -2105,8 +2094,6 @@ static void max310x_remove(struct device *dev) > =20 > max310x_power(&s->p[i].port, 0); > } > - > - clk_disable_unprepare(s->clk); > } [Severity: Critical] This problem wasn't introduced by this patch, but can max310x_remove() cause a use-after-free on struct max310x_port [1] by cancelling the port work items before calling uart_remove_one_port()? drivers/tty/serial/max310x.c:max310x_remove() { for (i =3D 0; i < s->devtype->nr; i++) { hrtimer_cancel(&s->p[i].tx_delay_tmr); cancel_work_sync(&s->p[i].rts_work); cancel_work_sync(&s->p[i].tx_work); cancel_work_sync(&s->p[i].md_work); cancel_work_sync(&s->p[i].rs_work); if (test_and_clear_bit(s->p[i].port.line, max310x_lines)) uart_remove_one_port(&max310x_uart, &s->p[i].port); ... } Because the UART port is still registered and the devm-managed IRQ is still active when cancel_work_sync() runs, concurrent tty operations or interrupts can requeue the work items before uart_remove_one_port() completes: CPU0 CPU1 max310x_remove() cancel_work_sync(&s->p[i].tx_work) max310x_start_tx() schedule_work(&one->tx_work) uart_remove_one_port() devres_release_all() kfree(s) max310x_tx_proc() <-- use-after-free [1] https://sashiko.dev/#/bug/linux-5f8166f2-80f6-4ce1-9c42-cff293ba7fbc --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202162824.3477= 9-1-hugo@hugovil.com?part=3D1