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=1796434043; b=i9JIo9QtUMuJVsAfjqRcpSlHIF9cty7DMxc/ArGnXK2sr+EQFtTRaBmrsQIEm0z6/Zif 3UIpJui294/SnZzyd+VskI+W7Qw0k/BCr+/Kwn+umthkUMHCu8wRJuSzRs4SJtHw5XVip aH8mo60aD/NlTmWeqWWEN1+qgV/uPFO39eyig0+X0DR9VY53llD+qp/ie15iTKDK8fleO tEBQBPB43bs4xj2hkZcqWDj59YbRAqK+3Sn7FhImvyLEjEtC+TRNLl780iXnFu+9Xeq34 Lw+LspkKdsNyRKEVbNLZPcP2WEewAk61gpJH9iuhIrbQkkTdIhlymHTxcrxjSHws0CQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796434043; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=DS0EBCCiHnmcZKWcG1Ydn7GzplkffyCmzWbr8kmHuXU=; b=WUVHKvkPu11I9hXYuHy1gVFWmKkdL/ENN7RKuYEGKsd3eM61on/APnzl+kfDkHCG7z6k l/aPoujhEFhAv9MDwPhwV1JizEhdIvixtLvlGVP9wpvZ84Kyd5ByWoZSFYDdV7hYKZbk4 64MS52zFo7zl5X3yuD/24xwWIZplTX3z67JIiUNrHGKbvWHglEVlL4pp4G1jF8CO2XrCc FgILvUOVuGUW40STGwjimwaX/lxFlaTX9XV2jN8IKsvSUXnb3ylMOG2v8ToMy7MkhiULo NfdhGJinhqlQfdv2Bt4g0IVhodhY9MF+r5LfezATeejtUegHOdrUFDi+jlfyPayUBJw== 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="isFtu/hC"; 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 CEB15606A322 for ; Sat, 5 Dec 2026 01:27:23 +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=isFtu/hC Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DBFA1F0092B; Sat, 5 Dec 2026 01:27:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796434043; bh=DS0EBCCiHnmcZKWcG1Ydn7GzplkffyCmzWbr8kmHuXU=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=isFtu/hCoctQPpOmwR3RMWT0BpwVoDSsdic1H9d9/JVL8uF31l06HUQJMJnZmQOcR jgaP7pQgkg7bK/0vqTZtup0qA+mBDkySx8M0eG/iHquirNsbDLr2NPL99cAtNSuO4K 80MQBW52pvrfOgFmpuSaqD/bglK3wlOcdyEA2Z9Fhf7H2jb/XLve9sqDrSaPzvUYaR cKMq6KYCOmFuMNvruWz9MC0MrCPDpsq9omo0t1EsIPy8QOHdFBKmWVMafXwDiA9c7L B+jQlb4EFoPYjr6uA9RuGTCQ7WYxeB4GLhOQOKBGOtJewBmsbhtB1J0CgHP77v7vxi 1mQLKfmLgTExw== Subject: Re: [PATCH can-next v5 18/24] can: isotp: rename rx_lock as it has become state machine lock From: netdev-bot+sashiko@kernel.org To: socketcan@hartkopp.net Cc: linux-can@vger.kernel.org, mkl@pengutronix.de, kuba@kernel.org Date: Sat, 05 Dec 2026 01:27:23 +0000 Message-ID: <179643404303.3142.10420243672979784094@kernel.org> In-Reply-To: <20261203-getsockopt-memcg-isotp-v5-18-bbe89b3d3b71@hartkopp.net> References: <20261203-getsockopt-memcg-isotp-v5-18-bbe89b3d3b71@hartkopp.net> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-can@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] The rename makes the lock's name and documentation cover more than the lock actually protects. -- can: isotp: rename rx_lock as it has become state machine lock This patch renames the rx_lock spinlock in struct isotp_sock to sm_lock, because it now serializes more than the receive path. It also rewrites the locking comment in isotp_rcv() to describe what the lock serializes. > diff --git a/net/can/isotp.c b/net/can/isotp.c > index 0aaf92e21feb5..e68a161b411cc 100644 > --- a/net/can/isotp.c > +++ b/net/can/isotp.c > @@ -182,7 +182,7 @@ struct isotp_sock { > struct tpcon rx, tx; > struct list_head notifier; > wait_queue_head_t wait; > - spinlock_t rx_lock; /* protect single thread state machine */ > + spinlock_t sm_lock; /* protect single thread state machine */ [Severity: Low] Does this field comment still match what sm_lock covers? The commit message calls the lock "a full state machine locking primitive". However, several state machine transitions in net/can/isotp.c run without it by design. isotp_tx_timeout() is the callback shared by txtimer and echotimer. It moves tx.state to ISOTP_IDLE with cmpxchg() and does not take sm_lock. Its own comment says: * cancelled under so->sm_lock elsewhere, so this must stay lock-free. isotp_txfr_timer_handler() re-arms echotimer and calls isotp_send_cframe() without sm_lock. That path updates tx.idx, tx.sn, tx.bs and cfecho, which isotp_rcv_echo() uses under sm_lock. isotp_rx_timer_handler() sets rx.state to ISOTP_IDLE without the lock. isotp_release() resets rx.state after it drops the lock, while the rx filters are still registered: spin_unlock_bh(&so->sm_lock); WRITE_ONCE(so->rx.state, ISOTP_IDLE); The new comment in isotp_rcv() gives a narrower scope. It lists the transfer claim in isotp_sendmsg(), isotp_rcv_echo(), and the tx shutdown in isotp_release(). Suppose a later change trusts the field comment and takes sm_lock in one of the hrtimer callbacks. Wouldn't that deadlock? isotp_sendmsg() and isotp_rcv_echo() both call hrtimer_cancel() on those timers while holding sm_lock. At the end of the series the field comment is still the same. Could the field comment, and maybe the commit message, state what sm_lock actually serializes? It could also note that the timer callbacks are lock-free on purpose. > struct mutex conf_lock; /* protects bind and sockopts */ > }; > [ ... ] -- Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203-getsockopt-memcg-isotp-v5-0-bbe89b3d3b71%40hartkopp.net