From nobody Mon Feb 9 22:39:20 2026 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ab0:32da:0:0:0:0:0 with SMTP id f26csp607174uao; Sat, 17 Sep 2022 15:29:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ghTbWetLCJT+wH7BM3Lv+W5vscZiJTlasxu7v4Lo2RfrhqJALAE2gw1WHjMvh6f8Csham X-Received: by 2002:a05:620a:248e:b0:6ce:5f25:deb2 with SMTP id i14-20020a05620a248e00b006ce5f25deb2mr8824042qkn.750.1663453782711; Sat, 17 Sep 2022 15:29:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1663453782; cv=pass; d=google.com; s=arc-20160816; b=wIMXISRPoKbxK2oFmJrX9XnVQYN7AFWjFOcAa45G0DWzHmmAUwD1q+WoJUM7g/LPVG Iwcsv88zV2Mn0V7flS22QjyHJeSy6MY8IP6jzK1LtLq4IcGPejoRXA7SS6KiT6VmSjy4 ofBOcjtJcfmQlBwm2PDC6CM9naYdl7upjc2jJotCYYhodhEOpOqxwJpbnsWnMDZuPuRZ TBi71ynEtETfBExubd3glW+v3lT8IobNZ/9RIOt7Lk9mT8A+TWD/XprcWDOb8Vov/+4F ZJ0gJYBL/bfffgXo9oLDMqQatJvfsKkCc64lfFmpFEhPhh/j+HbD9YnBfYPg4RnZ+Fzz skEA== 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:references:in-reply-to:date :subject:message-id:cc:to:from:dkim-signature; bh=PdOfAx87hUidcxyexSbnMCRoaRxCRRCf+MrLYZHkhkQ=; b=ys52TRqicXwOWos8QeSvwUNiwNSkOeuLA16/UWlsNCjDrz9SY8NbcBtdOdUsqhwYPE 64Fe9d3Zp6zSLn+kUug93Egif8uf6Mj0GFJmmIn16rHavJeNgWjNPWB9gl9zIh6dirhy ZZDH4K4RQw1Um4JPE96H6MQUcHc5ghC9XWBTjl2EE5xyK0I7EWRsJayMZoMwHc4pDKzl 8I6jKKFFjYs+A77aDVI1QTMXLrshhKAQ5piJNeCnASBzxqhU2ENqIkeUhGDVuBYhVUbR gUmtE4IlmRPbr4h2l69sCMtg5r8OvEOjBDBjCfBzVI9IPCXAkn7ieAWEm7XY3IespgYW /0Sg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=TrugaokD; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6302-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="mptcp+bounces-6302-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id t3-20020ac87383000000b0031898a8698dsi6718702qtp.534.2022.09.17.15.29.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Sep 2022 15:29:42 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-6302-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b=TrugaokD; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); spf=pass (google.com: domain of mptcp+bounces-6302-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="mptcp+bounces-6302-wpasupplicant.patchew=gmail.com@lists.linux.dev" 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 70C421C209BD for ; Sat, 17 Sep 2022 22:29:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 168105CA8; Sat, 17 Sep 2022 22:29:34 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from sender11-of-o51.zoho.eu (sender11-of-o51.zoho.eu [31.186.226.237]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 852535CA6 for ; Sat, 17 Sep 2022 22:29:30 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; t=1663453760; cv=none; d=zohomail.eu; s=zohoarc; b=MybpxLPW3aruFCqgsWr4V8zozzFCZi9+8ikHKGv/4qOuTqd/x8tmlyI1X5KdD3crApG2i+vrl1vsmDy1IXV5jVEmtZJ00rhPTw04QbUSi+Pvq7U6p0+m5sA0q1TOr7Dmuu/gCfOKNL6IX3UlFICou4DqJXePhKbBoYqOKbsOue4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1663453760; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=PdOfAx87hUidcxyexSbnMCRoaRxCRRCf+MrLYZHkhkQ=; b=QkpqXl4NYfYVdKTjxX4e7dvZBIe3uIhF6B2lqA3V5HewOqRQSzVvuu6c4i+Bekv0yHHKvSC+4UuhfMiing8X5f5caR4iwMhdzfrTKffEWbetZWO2s9FH//azklUvh2Vol4x7OqGq+2I9+bTnrWwT258muqzwWz+Pewt1Nl1jJSU= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=shytyi.net; spf=pass smtp.mailfrom=dmytro@shytyi.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1663453760; s=hs; d=shytyi.net; i=dmytro@shytyi.net; h=From:From:To:To:Cc:Cc:Message-ID:Subject:Subject:Date:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Reply-To; bh=PdOfAx87hUidcxyexSbnMCRoaRxCRRCf+MrLYZHkhkQ=; b=TrugaokDLbMM9E98JLViOqmXBy49GZp21ENWJe3q4X/DW8OD/DrnWrTaq4qEOzAD fZsdJ+YxstfYGU9BqrnqSgldNb/ckzl2LZVcZQqaywMg87vSJCdi/SdvCDap/hcOtuw ewJScKHrBh9mptgBpNhX/Pe01U8uY6xk2PzpK7Pc= Received: from doris.localdomain (243.34.22.93.rev.sfr.net [93.22.34.243]) by mx.zoho.eu with SMTPS id 1663453758548401.1813275717594; Sun, 18 Sep 2022 00:29:18 +0200 (CEST) From: Dmytro Shytyi To: mptcp@lists.linux.dev Cc: Dmytro Shytyi Message-ID: <20220917222853.2406-6-dmytro@shytyi.net> Subject: [RFC PATCH mptcp-next v7 05/11] Initiator: add locks() to mptcp_sendmsg_fastopen. Date: Sun, 18 Sep 2022 00:28:47 +0200 X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220917222853.2406-1-dmytro@shytyi.net> References: <20220917222853.2406-1-dmytro@shytyi.net> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" Suggestion of @mmartineau : 'add locks' is implemented in this patch Signed-off-by: Dmytro Shytyi --- net/mptcp/fastopen.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/net/mptcp/fastopen.c b/net/mptcp/fastopen.c index 9974508e0f4c..50b5c3376672 100644 --- a/net/mptcp/fastopen.c +++ b/net/mptcp/fastopen.c @@ -16,6 +16,7 @@ int mptcp_sendmsg_fastopen(struct sock *sk, struct msghdr= *msg, struct socket *ssk; int ret; =20 + lock_sock((struct sock *)msk); ssk =3D __mptcp_nmpc_socket(msk); if (unlikely(!ssk)) goto out_EFAULT; @@ -30,26 +31,35 @@ int mptcp_sendmsg_fastopen(struct sock *sk, struct msgh= dr *msg, goto out_EFAULT; uaddr =3D msg->msg_name; =20 + lock_sock(ssk->sk); + tp =3D tcp_sk(ssk->sk); if (unlikely(!tp)) - goto out_EFAULT; + goto out_lock_EFAULT; if (!tp->fastopen_req) tp->fastopen_req =3D kzalloc(sizeof(*tp->fastopen_req), ssk->sk->sk_allocation); =20 if (unlikely(!tp->fastopen_req)) - goto out_EFAULT; + goto out_lock_EFAULT; tp->fastopen_req->data =3D msg; tp->fastopen_req->size =3D len; tp->fastopen_req->uarg =3D uarg; =20 + release_sock(ssk->sk); + release_sock((struct sock *)msk); + /* requests a cookie */ ret =3D mptcp_stream_connect(sk->sk_socket, uaddr, msg->msg_namelen, msg->msg_flags); if (!ret) *copied =3D len; return ret; + +out_lock_EFAULT: + release_sock(ssk->sk); out_EFAULT: + release_sock((struct sock *)msk); ret =3D -EFAULT; return ret; } --=20 2.25.1