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=1796439749; b=1hF96X278lhoWEdKNKjmisN0ovbOJxY9aBAgSTIQyqxXaLiptILGFSRyE9KtdjY49ljB BfSK+we3Qrpt5hPketKSWV6QDKNI/SlQb+NTX/ZVMFETml8x5FU5Qqqw8TArLzJfd0Rya tqsTZdHtKJZZqDffLsRpsoihZ1m+nkRnDfEpqci2vHGBG+LX9O1sqZFzlNOZn13XwWMA8 g8weOkxg3uXZ8iLeiSk/o0sbzRwZjcomUwhFBG0ak6EpbuDJMBEvDZzw0NMeWWlx83Bva 6eHZM3pbjm1Zv4rZ4v6VTkKrB8uMXgmRYsn2/uYhmUbAZDNd2gysFm4FzaD0jj+85OQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796439749; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=nNQvQCl9Dl0lLUHiARpySTJEc8HbdEp6vJqV0M9L0y8=; b=urMjVP6VikbIEGyZUX7nk/w83O2pDxZC9e/m5s/WMMirEPqaf1kgxYinwieHp0nQds2x XoZZx6t4pdRjLBv2mvXDTiz1nWu2U68hIs12XJoBmNEgFGmFEIcPcCnl3lYTnmGfvl8WW W3Np5YipV2DM/pgt3mDU5n44kEUj9ISXsqLSzhkvU7itw9WQqT4ZtjC2S7dlpTbMMoVOI OHW+MsYAnw/jrupOBoNeYj/or/6BM5QyRowBFshHYeBHDigY1yUAdlLDNFJ8kk3tm1SDt suJdLor464SIptTjyCXRYsS3b9cbvpLj7mANqUiv5OYLFi8yqSqxs2waPkazsAQc+8Q== 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=eKMMLV15; 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 CD795606A322 for ; Sat, 5 Dec 2026 03:02:29 +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=eKMMLV15 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D5301F0092B; Sat, 5 Dec 2026 03:02:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796439749; bh=nNQvQCl9Dl0lLUHiARpySTJEc8HbdEp6vJqV0M9L0y8=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=eKMMLV15DxjJDzKRsy43k7v3MOVxd3cql+XgLiY7bDIZJGbrKxt3r+UtNRr8Tpo8p +81Z/yHhi/9b2AQam8FRtcx9yFD6TRRdio2rJvv7oEX7xI82EMFUeoGJoKu99clKLT pC9sovoblY3YLQEr8XSa4kBsfAoYJYaBKtzQ/az81kDNUkXl73NzUATODY4rhgXuZ5 a75+OQOBPQMMlVVGh6SV4MI94w3AHewDRbb6XgsajeHN4KADRFLaCvqpzJwz7Xzd/z PBz6sXnFftB6LFkhF0XvE56pdYCBKts3EufUwb3PLEzHpLFmQ8Ld/kXpXkHTX7Vugr BIJZsIaLE9myg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH RFC net v5 07/10] net/iucv: set RCV_SHUTDOWN under the socket spinlock Reply-To: sashiko-reviews@lists.linux.dev To: "Bryam Vargas" Cc: linux-s390@vger.kernel.org, "Heiko Carstens" , "Vasily Gorbik" , "Alexander Gordeev" , "Christian Borntraeger" In-Reply-To: <20261203-b4-disp-8029c32d-v5-7-0bce531e20d0@proton.me> References: <20261203-b4-disp-8029c32d-v5-0-0bce531e20d0@proton.me> <20261203-b4-disp-8029c32d-v5-7-0bce531e20d0@proton.me> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 03:02:29 +0000 X-Mailing-List: linux-s390@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/iucv: iucv_sock_shutdown() holds sk_lock.slock across skb_queue_purge() -- commit e0f230bbc48d968e7f41ede2bf00cba7029ceff8 Author: Bryam Vargas net/iucv: set RCV_SHUTDOWN under the socket spinlock This commit updates iucv_sock_shutdown() to set sk->sk_shutdown and purge sk->sk_receive_queue under sk->sk_lock.slock for HiperSockets sockets, and annotates concurrent sk_shutdown accesses with WRITE_ONCE() and READ_ONCE(). > diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c > index bf97b8c62eb2e..b9eecebbdff10 100644 > --- a/net/iucv/af_iucv.c > +++ b/net/iucv/af_iucv.c [ ... ] > @@ -1715,16 +1715,28 @@ static int iucv_sock_shutdown(struct socket *sock= , int how) > iucv_send_ctrl(sk, AF_IUCV_FLAG_SHT); > } > =20 > - sk->sk_shutdown |=3D how; > - if (how =3D=3D RCV_SHUTDOWN || how =3D=3D SHUTDOWN_MASK) { > - if ((iucv->transport =3D=3D AF_IUCV_TRANS_IUCV) && > - iucv->path) { > - err =3D pr_iucv->path_quiesce(iucv->path, NULL); > - if (err) > - err =3D -ENOTCONN; > -/* skb_queue_purge(&sk->sk_receive_queue); */ > + if (iucv->transport =3D=3D AF_IUCV_TRANS_HIPER) { > + /* Set the bit and purge under sk_lock.slock: a frame handled > + * on arrival tests RCV_SHUTDOWN under it, also while this > + * task owns the socket, and one that passed the test would > + * be queued after the purge. A frame that waited runs when > + * the owner releases the socket, not in between. > + */ > + spin_lock_bh(&sk->sk_lock.slock); > + WRITE_ONCE(sk->sk_shutdown, sk->sk_shutdown | how); > + if (how =3D=3D RCV_SHUTDOWN || how =3D=3D SHUTDOWN_MASK) > + skb_queue_purge(&sk->sk_receive_queue); > + spin_unlock_bh(&sk->sk_lock.slock); > + } else { > + sk->sk_shutdown |=3D how; > + if (how =3D=3D RCV_SHUTDOWN || how =3D=3D SHUTDOWN_MASK) { > + if (iucv->path) { > + err =3D pr_iucv->path_quiesce(iucv->path, NULL); > + if (err) > + err =3D -ENOTCONN; > + } > + skb_queue_purge(&sk->sk_receive_queue); > } > - skb_queue_purge(&sk->sk_receive_queue); > } > =20 > /* Wake up anyone sleeping in poll */ [Severity: Medium] Does skb_queue_purge(&sk->sk_receive_queue) need to run under sk->sk_lock.slock? skb_queue_purge() frees every queued skb before returning, holding sk->sk_lock.slock with bottom halves disabled across the whole loop. When shutdown(SHUT_RD) runs with queued frames, any CPU running afiucv_hs_rcv() in softirq context for that socket spins on bh_lock_sock(sk). afiucv_hs_rcv() holds sk->sk_lock.slock across both the RCV_SHUTDOWN check and enqueueing in afiucv_hs_callback_rx(). Once sk->sk_shutdown is updated and sk->sk_lock.slock is released, earlier frames are already queued, later ones see RCV_SHUTDOWN and drop, and backlog frames wait for release_sock(). Releasing sk->sk_lock.slock right after WRITE_ONCE(sk->sk_shutdown, ...) and purging under lock_sock(sk) avoids holding the spinlock during the purge and removes the duplicated RCV_SHUTDOWN check and skb_queue_purge() across the two transport branches. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203-b4-disp-80= 29c32d-v5-0-0bce531e20d0@proton.me?part=3D7