Message ID | 20240218081214.4806-1-remi@remlab.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-70284-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp683355dyc; Sun, 18 Feb 2024 00:19:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXILoYV8G99ZFRxXL/Wd91wriZFFv/q19iU8uvnGiwS2kLJmsL/XAlwFh4FjIM/8Q/dmR4VJa3KiJwlGjSHi4mxPtoZoQ== X-Google-Smtp-Source: AGHT+IEuqFnFaEr54+to2J9UHsS8PV8YR4YSo8ToZzasfyPSEqfC9Ul3965pxSz9qwHytERtCGwM X-Received: by 2002:a05:622a:1048:b0:42b:ff78:2033 with SMTP id f8-20020a05622a104800b0042bff782033mr11208324qte.56.1708244345300; Sun, 18 Feb 2024 00:19:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708244345; cv=pass; d=google.com; s=arc-20160816; b=RnHeLTDI4cxXMaDi3aKI0ihAHSsXKb79eKsOLJUf21ZlbbP+hdm7GSUXKX9/TvB2J8 BxzKLkiOC5TCRfHQzhlWevKCApNJYOErso+PMey16UFUx7/Zx5Wp5tkn7HzzO0mJSk0J 4JNSGD639HR3xyp+ha4owocf+6yH26zAh2o3r64KpPwigiDm6loYuSkub4f4TUAN6Gf/ XwS5HgS6IJOQmyIrFInO7/XRGfzptFGjqWgQRicLm/VMj9qOENulQahKlRuobu4h4NU+ Ima+gWRtfXwiBUD8QogrXVZw3E/lQ1QaqKI4pplH2gUsO5qu9uB/AG+5VRbo406K3aFw u0Aw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=Uq4bX3FDwWmCFoxHRnQe9ikiqPvsxwPu10ZXHwC+AlY=; fh=c/0DG8ZjWOGj3xa2WSPqExKKwAhUSsqk5MlZk+0ao+k=; b=catnTrFW6zaeUp27d9SJO7EcwiIqqrT+B6p6KjswgfbLkTdcF7mqUGsUQ7trQ8bB6V Q+wOzNDSNiv53rA7OHUeRc3iMtAx0PJ5C3ueFWHEycN2IySW7muHGQ8fZg4nW1IpipiI yyq7o0bTMa1d+oT93mUY+WjDaCSvtnsxeUc91GAmbfu+ZDv4a1TsgAg31OrYFhKlbfFc NjNDrbvfBLkQSzVCqWddYvPj8jvF5V3hsOM9V7OT+0cS7UuKQJsOgMA/kLf6Hi6p2IZ6 2GEs/xMVbnwEx2Iib99+l0BvBXWGQkRwCPxLvcYYZm7QP+0t3kGnmuAwgsMs3KcmZnJ8 QTug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=remlab.net); spf=pass (google.com: domain of linux-kernel+bounces-70284-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70284-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id l23-20020ac848d7000000b0042c73051388si3565751qtr.211.2024.02.18.00.19.05 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 00:19:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70284-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=remlab.net); spf=pass (google.com: domain of linux-kernel+bounces-70284-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70284-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 1E1271C20BAE for <ouuuleilei@gmail.com>; Sun, 18 Feb 2024 08:19:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7CEC915485; Sun, 18 Feb 2024 08:18:43 +0000 (UTC) Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A7B8AF4F1; Sun, 18 Feb 2024 08:18:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=51.75.19.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708244322; cv=none; b=sd5hujVQzNKRCWiWRqMt9haoRpjOEcMfG8/ZcPWOUsbMfMrXteOqshWCKfWHmugmnwFwQHMTvXzGv2TOaTV6aw/t4HkJLV8j3wbpvFEBlwt6gX8HvIWfi3WJeJq3v5siXdKB+BZbRY4r/AR8YtOosrSDNe/WMV6QQv3Li6etZDo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708244322; c=relaxed/simple; bh=2BxMlDkylEFurkwztrKxyMnalnAGW1HP3gxdQbPTudc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=lnm9Pk1NDVfsQmO2D1VjJQlD5/kJ0GlGIxx+9uhSXYjQG9TJ58xQMQDRKDUa1sDPborYyv/v9dQv9rolDQrvXdvt6dOQjY5g8YKrtlJASJa+krL25iqvTXdciOBD2UqZ9Ug/cAOaGcCqsboen732AExe3MuuVZdgR19wBafJgpM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=remlab.net; spf=pass smtp.mailfrom=remlab.net; arc=none smtp.client-ip=51.75.19.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=remlab.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=remlab.net Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id AF07CC006F; Sun, 18 Feb 2024 10:12:14 +0200 (EET) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= <remi@remlab.net> To: courmisch@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCHv2 1/2] phonet: take correct lock to peek at the RX queue Date: Sun, 18 Feb 2024 10:12:13 +0200 Message-ID: <20240218081214.4806-1-remi@remlab.net> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791224022484563486 X-GMAIL-MSGID: 1791224022484563486 |
Series |
[PATCHv2,1/2] phonet: take correct lock to peek at the RX queue
|
|
Commit Message
Rémi Denis-Courmont
Feb. 18, 2024, 8:12 a.m. UTC
From: Rémi Denis-Courmont <courmisch@gmail.com> The receive queue is protected by its embedded spin-lock, not the socket lock, so we need the former lock here (and only that one). Fixes: 107d0d9b8d9a ("Phonet: Phonet datagram transport protocol") Reported-by: Luosili <rootlab@huawei.com> Signed-off-by: Rémi Denis-Courmont <courmisch@gmail.com> Reviewed-by: Eric Dumazet <edumazet@google.com> --- net/phonet/datagram.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Comments
Hello: This series was applied to netdev/net.git (main) by Paolo Abeni <pabeni@redhat.com>: On Sun, 18 Feb 2024 10:12:13 +0200 you wrote: > From: Rémi Denis-Courmont <courmisch@gmail.com> > > The receive queue is protected by its embedded spin-lock, not the > socket lock, so we need the former lock here (and only that one). > > Fixes: 107d0d9b8d9a ("Phonet: Phonet datagram transport protocol") > Reported-by: Luosili <rootlab@huawei.com> > Signed-off-by: Rémi Denis-Courmont <courmisch@gmail.com> > Reviewed-by: Eric Dumazet <edumazet@google.com> > > [...] Here is the summary with links: - [PATCHv2,1/2] phonet: take correct lock to peek at the RX queue https://git.kernel.org/netdev/net/c/3b2d9bc4d4ac - [PATCHv2,2/2] phonet/pep: fix racy skb_queue_empty() use https://git.kernel.org/netdev/net/c/7d2a894d7f48 You are awesome, thank you!
diff --git a/net/phonet/datagram.c b/net/phonet/datagram.c index 3aa50dc7535b..976fe250b509 100644 --- a/net/phonet/datagram.c +++ b/net/phonet/datagram.c @@ -34,10 +34,10 @@ static int pn_ioctl(struct sock *sk, int cmd, int *karg) switch (cmd) { case SIOCINQ: - lock_sock(sk); + spin_lock_bh(&sk->sk_receive_queue.lock); skb = skb_peek(&sk->sk_receive_queue); *karg = skb ? skb->len : 0; - release_sock(sk); + spin_unlock_bh(&sk->sk_receive_queue.lock); return 0; case SIOCPNADDRESOURCE: