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=1796212930; b=KxBXxXQ/+rj3149TOSgJ6ppWmZzmoYCah43IZr17qZXh1Lu1zu9a1ZlNX6kWcfGmDWax ElP2e47zDr2lm2wyH1rPyMB8K38e7Tsl1U9XY5nKIOa1B+XS/IHS42cMiMCjdgmGVqqZi KgDOzkaPTs4YEFqTgSss1ZSzSCqBNaX5vtb6R4deQdu43FY7WhflZtNTn1KSWki+29I0s 4rbWNbH12Z9JhIu+T0+CalLEepCyZ8WG2iAKrI/0yGasRfGtoSLICdIjYadQyP5tkMFoJ OOvB8Dror3U7RbVDcAjsxSEhLnFbJm/q0i0qwkV2efb/QCxFzzyBx02tMC4RvZ+mw5Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796212930; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=ge3H/+/UrSWO/nc3aYOCvWic45oO6mm7JagOhGpSddM=; b=bBbzqQYuPeHTaB0M9SQe4zNdPpNodMSGoUIdhuI8Cjwu4jh5T5qdD71p9fBs2dbTtdWm KbHNkuGu2W5rskPYaK2mC7w07g9sEDLjohcAgU4WQ46nCbY+/ulJc5kK4xvMwLgOD5/Ws ff2mt6Y4JPPNIk3RWsU1ctVQAKIhZUdJoCmxBvqy0gLSOKwh3zFs2vq6Zf3kEfB7ZmTpL XhLZGxpqsWO2xGnU8u5lcffo4/wl9gi7iyqrnllLIpxBqYMpf5nsHyhiSogo+5d9RCZeV aVIZnudWtDBMNhZUyKZNRqBNRQIsCo0SaCBxvAMuHGrfqycnlx6iK0M8fmy8y0RSyaA== 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=MvqZlACU; 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 3F183606A687; Wed, 2 Dec 2026 12:02:10 +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=MvqZlACU Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8E351F00899; Wed, 2 Dec 2026 12:02:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796212930; bh=ge3H/+/UrSWO/nc3aYOCvWic45oO6mm7JagOhGpSddM=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=MvqZlACURb0+ur3QFm7kAN5+KYvTSxuz8+94km1YVOMBGC4n0jZBVGy1YFkBTr9Yr gsTfx5aawRkpbB3bNbk5B7GidzLdvf5OtMCIW3Iwg/eccSlLrHR6WZiZgSe1uRzEEv VtTkWKM3oRx0gtkvgMNRuuOcB+UJbAP9gEtX/jVPW/z356C47KNgrRIl5LlwoMLiux MHm6QtBY7BepL6vqr3azu0BHKuhknmyQZjfpn8tw6D29yZ8OFOMCUqdFJaRu/O1h42 7aoUiXj7LuDR+ybi5B+q7we3U2MSN+25jmKlhpZp0ZXzsAYm0AVRmHGxpA4pRLKeDd ZnVKGNnRglbZg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH net v3 1/2] net/x25: don't call lock_sock() from softirq in x25_kill_by_neigh() Reply-To: sashiko-reviews@lists.linux.dev To: "Martin Schiller" Cc: linux-rt-devel@lists.linux.dev, linux-kernel@vger.kernel.org In-Reply-To: <20261201-x25-kill-by-neigh-v3-1-7f05bdff15b1@dev.tdt.de> References: <20261201-x25-kill-by-neigh-v3-0-7f05bdff15b1@dev.tdt.de> <20261201-x25-kill-by-neigh-v3-1-7f05bdff15b1@dev.tdt.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 12:02:09 +0000 X-Mailing-List: linux-kernel@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 1 potential issue to consider: - [Medium] net/x25: missing X25_KILL_FLAG check in x25_process_rx_frame() -- commit c78b5f40e4fa8e2412e3a3fc71a271972e1bbfc0 Author: Nguyen Ngoc Thang net/x25: don't call lock_sock() from softirq in x25_kill_by_neigh() This commit replaces lock_sock() in x25_kill_by_neigh() with the socket spinlock, deferring x25_disconnect() via X25_KILL_FLAG and a proto release_cb when the socket is owned by user context. > diff --git a/net/x25/x25_in.c b/net/x25/x25_in.c > index e47ebd8acd21b..297acfdbfb05d 100644 > --- a/net/x25/x25_in.c > +++ b/net/x25/x25_in.c > @@ -450,7 +450,12 @@ int x25_process_rx_frame(struct sock *sk, struct sk_= buff *skb) > =20 > int x25_backlog_rcv(struct sock *sk, struct sk_buff *skb) > { > - int queued =3D x25_process_rx_frame(sk, skb); > + int queued; > + > + /* Serialize against x25_kill_sock() like the softirq receive path */ > + spin_lock_bh(&sk->sk_lock.slock); > + queued =3D x25_process_rx_frame(sk, skb); > + spin_unlock_bh(&sk->sk_lock.slock); > =20 > if (!queued) > kfree_skb(skb); [Severity: Medium] Should x25_process_rx_frame() also bail out when X25_KILL_FLAG is set? When a socket is owned by user context, x25_kill_sock() only sets X25_KILL_FLAG and leaves x25->state and x25->neighbour intact until x25_release_cb() runs. However, release_sock() drains sk->sk_backlog via __release_sock() -> x25_backlog_rcv() -> x25_process_rx_frame() before invoking sk->sk_prot->release_cb(): net/x25/x25_in.c:x25_process_rx_frame() { struct x25_sock *x25 =3D x25_sk(sk); int queued =3D 0, frametype, ns, nr, q, d, m; if (x25->state =3D=3D X25_STATE_0) return 0; Because x25_process_rx_frame() does not check X25_KILL_FLAG, frames queued on sk->sk_backlog before X25_KILL_FLAG was set still run the state machine for the dead call. For example, a backlogged X25_CLEAR_REQUEST or X25_CLEAR_CONFIRMATION frame calls x25_disconnect(sk, 0, ...), clearing x25->neighbour and setting sk->sk_err =3D 0, so x25_release_cb() then skips x25_disconnect(sk, ENETUNREACH, 0, 0) and clears X25_KILL_FLAG, losing ENETUNREACH (and without commit a2f4e558b645 ("net/x25: re-check x25->neighbour after re-acquiring the socket lock"), allowing x25_recvmsg() -> x25_check_rbuf_owned() -> x25_write_internal() to dereference a NULL x25->neighbour). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201-x25-kill-b= y-neigh-v3-0-7f05bdff15b1@dev.tdt.de?part=3D1