Article View: linux.kernel.netdev
Article #5385Re: [PATCH net-next 3/3] net: qrtr: implement shutdown()
From: netdev-bot+sashiko
Date: Tue, 20 Oct 2026 09:35
Date: Tue, 20 Oct 2026 09:35
86 lines
11036 bytes
11036 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] net/qrtr: shutdown() API violation leaves sendmsg() threads
hung
--
> diff --git a/net/qrtr/af_qrtr.c b/net/qrtr/af_qrtr.c
> --- a/net/qrtr/af_qrtr.c
> +++ b/net/qrtr/af_qrtr.c
> @@ -1193,6 +1194,36 @@ static int qrtr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
> return rc;
> }
>
> +static int qrtr_shutdown(struct socket *sock, int mode)
> +{
> + struct sock *sk;
> +
> + if (mode < SHUT_RD || mode > SHUT_RDWR)
> + return -EINVAL;
> +
> + /*
> + * This maps:
> + * SHUT_RD (0) -> RCV_SHUTDOWN (1)
> + * SHUT_WR (1) -> SEND_SHUTDOWN (2)
> + * SHUT_RDWR (2) -> SHUTDOWN_MASK (3)
> + */
> + mode++;
> +
> + sk = sock->sk;
> +
> + /*
> + * Do not use lock_sock() here: sendmsg() holds it while sleeping on
> + * remote flow control, which would block shutdown() indefinitely.
> + * The spinlock only serializes concurrent shutdown() callers.
> + */
> + spin_lock_bh(&sk->sk_lock.slock);
> + WRITE_ONCE(sk->sk_shutdown, sk->sk_shutdown | mode);
> + spin_unlock_bh(&sk->sk_lock.slock);
> + sk->sk_state_change(sk);
> +
> + return 0;
> +}
> +
> static int qrtr_release(struct socket *sock)
> {
> struct sock *sk = sock->sk;
[Severity: Medium]
With this change shutdown(SHUT_WR) returns 0, but a thread that is
already sleeping in qrtr_tx_wait() from qrtr_sendmsg() is not woken.
sk->sk_state_change() only wakes the socket wait queue. The sender
sleeps on flow->resume_tx instead, and the wait condition in
qrtr_tx_wait() only looks at flow->pending, flow->tx_failed and
node->ep, never at sk->sk_shutdown.
The changelog does call this out, but it breaks the common pattern of
calling shutdown() from one thread to kick a blocked writer out before
joining it. That now hangs until the remote hands back credit or a
signal arrives. Before this patch userspace at least got -EOPNOTSUPP
and knew it had to use some other mechanism.
The stuck sender also still holds lock_sock(). So the close() that
normally follows the shutdown() then sleeps uninterruptibly in
lock_sock() in qrtr_release(), as do ioctl() and the other
lock_sock() users, which is hung task territory.
Would it be feasible to also check SEND_SHUTDOWN in the qrtr_tx_wait()
condition and wake the relevant flow->resume_tx from qrtr_shutdown()?
The flow is keyed by node and destination port, so it is not obvious
how to reach it from the socket. Did you consider recording the flow
the sender is waiting on, or is there a reason to leave this for a
follow-up?
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261016-qrtr-add-shutdown-v1-0-e1cc01ca5919%40oss.qualcomm.com
Technical Details
Message-ID:
<179248895481.3135.9231497728918795508@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349150-linux-kernel-netdev=dewy.ruReferences:
<20261016-qrtr-add-shutdown-v1-3-e1cc01ca5919@oss.qualcomm.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349150-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next 3/3] net: qrtr: implement shutdown() Date: Tue, 20 Oct 2026 09:35:54 +0000 Organization: Usenet Network Message-ID: <179248895481.3135.9231497728918795508@kernel.org> References: <20261016-qrtr-add-shutdown-v1-3-e1cc01ca5919@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3823038"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Fzj7pNIzHs2Rn2sgY0Tgke1MS50= sha256:jtu0l5Z3sb70X+M9HK5h0UrZ5LFe55//a4C30by9M8k= sha1:NEQ3r+gxoUdL/LBaLcZV02z1N6k= sha256:zxab9yE07ts0voeV+/uKzXAkRe7EPNbL/aPjm1dRjCI= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 0E519110C69; Tue, 20 Oct 2026 12:41:56 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.728 X-Spam-Status: No, score=-3.728 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.329, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kV43wVac3zMy; Tue, 20 Oct 2026 12:41:52 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-349150-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 10F26110C5B; Tue, 20 Oct 2026 12:41:44 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id E3B922C46D; Tue, 20 Oct 2026 09:36:17 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792488968; b=FZKq4Wg/Q0aUm4X1iAZNEgiSX+EsaVRhd+IVt7+LcZSJITtletdrJ+u/bFyCEU0HIEsv vNgbyfz7305dgN42K4krt6v+GpyG0tjCvW7Yl1oZ5k3RItaqpGNDkLsx4UKHzIIQzXzmw /qe5OvkgI6ISkUgRUqiJ9CfWPeTa3KNEB2i0cGEDb9AnjphG3ZKN8JNlGKrSuiFiPZwVo 0R0Hpau1NGzAeMckAjiqwQgP8e8qq2VdRvh8neAzKXu5yd+ePeF9nsuG5EvVgGCfUwKOf hUO2hHcgGAkt7ZVSygNsU3IwObIlqsyWM5Cf8AKJwrTNEjd4VJ3mJhpPa3q9zjrakaQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792488968; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=DmBZqT4kDURn/Q/aVDSwiHBGADQ7218v0k2fMHT5IG4=; b=Y58ukzUlk8Dah/xgTl527VRUl7n38ND3hsphR5Vhr7JphN0q6Z1wgCalJcdWIYPw9/YW DPW493utmfMZ/47rTL6IpqCtFqO0Qzp+AkdSa+Nc6315OcR3qTZ9Hhn+6dz0lV6TeLuaD C6XVCDRJVFF6AVZYJrbj7wfgUtUHG7TqfldDXLA8ncpmZeICmcijyJ889AmW2B+bQfzhS SoO1bp6ChkPyHhGKDTK10czrnBi5zLIySIGhzTGxdmiFwskwy4zOx10M9rPFKMnee+yXq 3CJ3FXKgxNJLIkg9ekCVnlW6eK+CetHlIJGtKnq0+MBStkBDZw2xIsWWV40UbhdPyxg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="G/n6xe59"; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 540B4606A330; Tue, 20 Oct 2026 09:36:08 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=G/n6xe59 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792488956; b=3Z7LQiHmHHQsaJ88RpC+DsJwZJeEY64BzxB/j/VqQLarJUrTr7dEJMgZaOfDokBUDEYt batIGB1oVcvRTzYRUY+dvgDh6o5WKoJSMfsofvw/HQXdYriwZmrLcUG4kgY4QmSM90hc8 rPI4I8l4OTQ2D17dAYeDesDZ/F5G+Lvj5E5hwJYtyI57KcYhqnrlZ/A0lnxFZ8IcPCQCe qRDY4yAk5Vwxo/r/xsCGD0vQaElqVJg9a0kijRtJvktrZq9NgFALLuMT4bc6DhiKlNRa2 SCi7g7WIbMcBbXveE+hSx6TI9QaFBCQcHoYt4sfJOxVakR9zMjm8Nii1CP1/5B6fuVA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792488956; 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=DmBZqT4kDURn/Q/aVDSwiHBGADQ7218v0k2fMHT5IG4=; b=ZtBH5ZVvVBWxtATynUU8H3MT747S0WfQZQJEE0Vnle5RgHDI656KJ64QT3MaBkbUySOq RhaYnRQGIEXCN7zMJVGdhqc5jc45J21TnFfceYqB5n1GR6PsSASYyDPG/iIvhLbHovsQ9 g/wdqfcykSFbp/wgxRPvpVclmezjGDbcScI7enEyRlhyPpgoHDgw00rW+OVC50LdWjUiJ WitYMnNtWVjYSihmCqvSoojEzbjPc+8CTov39skhJBIcIWAA9Qa8TwSQX+Wtd+WO1hF12 Vf5KHPabR7lar2XmnidosjVIFMh/3CdFUhAvE7gcQ0fwskstbzl7WgLas7lU3OOcXEA== X-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="G/n6xe59"; arc=none smtp.remote-ip=100.103.45.18 X-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 63B56606A32F; Tue, 20 Oct 2026 09:35:56 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EA5C1F000CA; Tue, 20 Oct 2026 09:35:55 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792488956; bh=DmBZqT4kDURn/Q/aVDSwiHBGADQ7218v0k2fMHT5IG4=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=G/n6xe59JHFjBkoLCQ5PZ5cvrjM74taW5CSYGC3gZeiyPLlCjonLaXlzkS284Kpe5 LyDjZCx7jKRo4zBy0UkeCDPzIPSSnZfc9zrNn22Mi11SX62Mr3sbuy5XjLm14VYVSM QRfkHngjo5gKylr3QFDf+Vb+U3+NBW9jfzR+Qd/NhI4uOYMKq75holjS/sqLjnzynr 9e1DEakPN/fOu73gR0Xpd+Zig3JtaxLYoZRYPKEedLu/yHl3IhCnuTnxyDqe/DrREx h+lpt0iL3N1ISCBgI6a802kzG9BXFRRyeLNVtA6UP7P66d2lDyyvy86aYH3jR0RSKb MSYLh91V/C8Uw== X-Cc: mani@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, tao.zhang1@oss.qualcomm.com, peter.chen@oss.qualcomm.com, jeff.johnson@oss.qualcomm.com, konrad.dybcio@oss.qualcomm.com X-In-Reply-To: <20261016-qrtr-add-shutdown-v1-3-e1cc01ca5919@oss.qualcomm.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list