Received: by 2002:a05:7412:9c07:b0:fa:6e18:a558 with SMTP id lr7csp51364rdb; Fri, 26 Jan 2024 18:31:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IEyO9zggAberrCHFrNuVJc5yia+9kiRXBF98KCDz3FfsyjdhmxlCgI3svWfks7qQtyJsAxt X-Received: by 2002:a05:6871:7827:b0:206:c602:9c2b with SMTP id oy39-20020a056871782700b00206c6029c2bmr800114oac.38.1706322681933; Fri, 26 Jan 2024 18:31:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706322681; cv=pass; d=google.com; s=arc-20160816; b=EwrGo9sTFo/c2mrosd0e89StHeMWhgCwMjHtKtZKDTUxZfqE8+KmhLXmc6z4S2soa8 M50eQMizM6V1LCyyMn1rg6ys9SjtUyhTICMlPAk6V8zdxRw46UuKX+LOVPXPAk8m/sgl FqGNbM5DSElL+mz+I/WF4bMowu5jJQ7wgxkkB+Q5tnbusPDyP1L3AgFUM//gFNifvRcf RRVfnwdSpz/eB3yc5yx6GoOm2ZbEYzf5RePMyHX1YfLxlZq7garipErgaBu8DOxOv8xH mZDUCurDGre8xwWjGdbAGyPVg5L0wX80G1cAeTiO1N1hQRexQ6yUd8jHBlFMidrfpzX1 KsIQ== 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:message-id :date:subject:cc:to:from:dkim-signature; bh=n3Eqaf0JpcfE9VphQ2k45PLVkc2qGy56bLUTBAo+DzE=; fh=G5DaSdor7MropyFk0CA4E4srFTXsRWsLAIC8xcZLlO4=; b=rfcCIl5BSZJyvC+KtW6ZU0z2dIJUk7lgJ7tTetA+92WKy5c/VB7v8EB+xjhbsYmWU5 +0l8+mLM/Jw9+x1/23q2OoPp8+RuqA3BiMwUin7igCLSElfWEahJrWDGvhJjDeOkyVlg vkDbOwyiMRpRa5dEhVwE/MUTlurKc1mMcX/52NiFE+pA3GduduK1vSiI+s8z0fJp73hB HBAqeB53QoFENR55BQLL3NjBX6qk3h8gwHFfxx8xz2FgvinlIxnhjwuE3Tv19P2ACSlk KMVDzCKwMZMp9x+F4gnZoRENSB79ogxl5Ei/3wHUYdE2xyTeJxDVnK4Bc4WfWz6Y1/Au W6Mg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=vPx2lXWr; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-41012-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41012-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id y6-20020a633206000000b005d68eec351esi2010523pgy.740.2024.01.26.18.31.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 18:31:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-41012-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=vPx2lXWr; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-41012-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41012-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id EEE75B2504B for ; Sat, 27 Jan 2024 02:15:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F28151DA3E; Sat, 27 Jan 2024 02:08:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="vPx2lXWr" Received: from out-177.mta1.migadu.com (out-177.mta1.migadu.com [95.215.58.177]) (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 7AF4B14274 for ; Sat, 27 Jan 2024 02:08:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706321327; cv=none; b=d8OdhFmZRnGkDVuo/l88NgOGJnb9qM9pyxuhKaMo/nBLtJEmV13Na4+PCt4MTjSOm9JXnmUAjdqglZyuKKyGCLflwrMorWXq2yNLso6I5q8rmjB8puH8ESlYMsXr6Sl0py1bbxHvJDtNF5z1KwZdPPmBwPLQ7D89URUpzHLElZI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706321327; c=relaxed/simple; bh=pn08eJXs7OnPxSN3c37dEpPPa01CX6MaTgxVEqfxj/E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dIOkSiLQ8hWuenpWvG3ziEkrnQSl40wndbhOBlIT8K1Hc/iFN6WscgDJjJG9E31o1+TzvWA7lD+OgDU3QrJ42+54OLiR6DDcWiZJUPbK+flbnm0F6i+WSyZdNwUWmQNHA2ow4hrNfBIZadYdrNXwcqMi50epDprgfsXan0+Ep3E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=vPx2lXWr; arc=none smtp.client-ip=95.215.58.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1706321323; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n3Eqaf0JpcfE9VphQ2k45PLVkc2qGy56bLUTBAo+DzE=; b=vPx2lXWr9tcHGNC+54266m4I5ZFB0bMBCYBcm95hK18A/i6lbfbV2osBlEQRdcUNMpVu20 6Ssh5ZGyhngGcYn72bo2I8oqgsP7m6dfu5Q4oHlUu7g87bYiWSLBO4/21mPcbIrciEuI6e dpK5TGsVN1S6s2l5Jb0EARayllJw9LY= From: Kent Overstreet To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: Kent Overstreet , peterz@infradead.org, boqun.feng@gmail.com Subject: [PATCH 3/4] net: Convert sk->sk_peer_lock to lock_set_cmp_fn_ptr_order() Date: Fri, 26 Jan 2024 21:08:30 -0500 Message-ID: <20240127020833.487907-4-kent.overstreet@linux.dev> In-Reply-To: <20240127020833.487907-1-kent.overstreet@linux.dev> References: <20240127020833.487907-1-kent.overstreet@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Cc: netdev@vger.kernel.org Signed-off-by: Kent Overstreet --- net/core/sock.c | 1 + net/unix/af_unix.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/net/core/sock.c b/net/core/sock.c index 158dbdebce6a..da7360c0f454 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -3474,6 +3474,7 @@ void sock_init_data_uid(struct socket *sock, struct sock *sk, kuid_t uid) sk->sk_peer_pid = NULL; sk->sk_peer_cred = NULL; spin_lock_init(&sk->sk_peer_lock); + lock_set_cmp_fn_ptr_order(&sk->sk_peer_lock); sk->sk_write_pending = 0; sk->sk_rcvlowat = 1; diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index ac1f2bc18fc9..d013de3c5490 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -706,10 +706,10 @@ static void copy_peercred(struct sock *sk, struct sock *peersk) if (sk < peersk) { spin_lock(&sk->sk_peer_lock); - spin_lock_nested(&peersk->sk_peer_lock, SINGLE_DEPTH_NESTING); + spin_lock(&peersk->sk_peer_lock); } else { spin_lock(&peersk->sk_peer_lock); - spin_lock_nested(&sk->sk_peer_lock, SINGLE_DEPTH_NESTING); + spin_lock(&sk->sk_peer_lock); } old_pid = sk->sk_peer_pid; old_cred = sk->sk_peer_cred; -- 2.43.0