From nobody Wed Nov 27 04:46:18 2024 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2069.outbound.protection.outlook.com [40.107.249.69]) (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 D1F301BC063; Mon, 14 Oct 2024 15:13:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728918802; cv=fail; b=mBaYlkySOctar7QpsWnftN1mCgEF9Afh2Ti0T8mh3NLImMpEo2DzNCmAI0dntM22bhXOo//1rBFTxFI8zeoMTn4SPdetRPSw/RF31D8j2d9irNOKgTN9Pd35lLdf8iFm2TyePE5VkTDCGbTi27aRRGWju6o3rosnnW/NI4Bs4Z8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728918802; c=relaxed/simple; bh=uNPSrxx5q1hUk1b0BLN0tuZRsSWwhgD7UivxKUuvSqQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=W7wAAeclj5CM87bEw9qRUpEGONlelKkHRdwM9Dp/rtLcLmhUnSlaHTf/yosRYKSx1yjUI0jbwJvnp+mpRWmO8ghX/Hoo1N5qCCXdb0QQ68GXT5z89waIGR4Z6EvmhaXf80CA0DxuGY4oi04h+R2Y8NQjRGhPn6K1E7wu2vhX2Jo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nokia.com; spf=fail smtp.mailfrom=nokia.com; dkim=pass (2048-bit key) header.d=nokia.com header.i=@nokia.com header.b=n7SitMhT; arc=fail smtp.client-ip=40.107.249.69 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nokia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nokia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nokia.com header.i=@nokia.com header.b="n7SitMhT" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QEXFtL6IVU+uhN6WQpbiToe7llt6DNtNSYyTm/UVpoHhdEQf7EpJvtvG07JQ6mW9kJ1OgTkbgrSsKRgeVI+I+sE0rCK34b1G+4jjW6Fd+Y88XljZX2rgv29EKy1LhSxdLDRY6ZbEJVyoUhyw2CBcWIakfTHAE8B9G+qJO4gO5hqVaLJN6rBW6VE0o+UM3ZfpUd1Dvuvcz/xOwLJ8YD+4zL67FgYHUsPf6ClBf4kZ24cKZI1v9F+MNrUe8tOIQMeK4mNmf4FRuBjbKUlhAUujgYEc1rzYNAiQTtdPl9DSmbf3a8xhTlNOjMof16F5BoR9H9W7z+CoKxWPxJdR/QsmVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=b7Te0e1NWmEHgDBxg3djRHVGSiYFJFAJHD9djD61o7I=; b=hA6ZBo2ATIGutQcvo4WjOR+vmp5eLpPzOC0ncu2An8fkxl5Z7bD3uUo1aPF4AOaDi+1I288E2d2LbHEPBjmlkzUuWkH+QLpdeRgPPgwbVps7m25L0lo0YAMwhhgFClvTMJ6UvCqjB5vlnPBXvmZkK6R9oAMC1T+LSOr7NIpfPME2HmL4Z8z2JAN5KVHC7jAy6cAZaknMb1mB5QDG84C7pIltyNEAA1p2zUwxuDKhCoDNLsThIUzq8rszsXLuJ4Z+2dTMLo/S65GIrhdmgQkb1ChQ1Bju5WtA8j9p1Mbep2MVlalOyswobYmbB1N5AzAZqCK1UP9QvUOnBlr0JPNvQw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nokia.com; dmarc=pass action=none header.from=nokia.com; dkim=pass header.d=nokia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=b7Te0e1NWmEHgDBxg3djRHVGSiYFJFAJHD9djD61o7I=; b=n7SitMhT4LpnVmmYm/s6POFzdnUwTJVJ1SESzuIlsT0z4WrBEGx7B07tQloENb+peONOQUxHkNLA7CkCiVeot2O4E3ohUVVvKP22gJdn6DX+UdhBALYSbLWCdfVt9X4qtw9Q7vq3s4zyBRsgtzYOZK9MsNIjQ8qR3PYm3GR9b4Tg6aBrx9cPXM7rYEz+yCyI95buOIbZApEstJWQ43vL6TmtKpnDx77plVSb2IADFDYm6CwSyIURbas5jTC2VgCPNbVlyOX0sFs/lWGYyqSn5BlYdJCNZ8UgnyWsT1MEXU3izVn8YOy7Cy9GBXcd0v+rkeMiQD543i99Q1yUKMHc2g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nokia.com; Received: from PAWPR07MB9688.eurprd07.prod.outlook.com (2603:10a6:102:383::17) by DU0PR07MB8905.eurprd07.prod.outlook.com (2603:10a6:10:316::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Mon, 14 Oct 2024 15:13:13 +0000 Received: from PAWPR07MB9688.eurprd07.prod.outlook.com ([fe80::6b9d:9c50:8fe6:b8c5]) by PAWPR07MB9688.eurprd07.prod.outlook.com ([fe80::6b9d:9c50:8fe6:b8c5%4]) with mapi id 15.20.8048.020; Mon, 14 Oct 2024 15:13:13 +0000 From: Stefan Wiehler To: "David S . Miller" , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Stefan Wiehler Subject: [PATCH net v5 07/10] ip6mr: Lock RCU before ip6mr_get_table() call in ip6_mroute_setsockopt() Date: Mon, 14 Oct 2024 17:05:53 +0200 Message-ID: <20241014151247.1902637-8-stefan.wiehler@nokia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20241014151247.1902637-1-stefan.wiehler@nokia.com> References: <20241014151247.1902637-1-stefan.wiehler@nokia.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: FR2P281CA0019.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::6) To PAWPR07MB9688.eurprd07.prod.outlook.com (2603:10a6:102:383::17) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAWPR07MB9688:EE_|DU0PR07MB8905:EE_ X-MS-Office365-Filtering-Correlation-Id: 71892a0b-665d-4792-94e9-08dcec62b923 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?IARU/QbAQTIEwMNgdMOx0xRy+lhv/1qLzQnYc4nsLEMhi+BQnHMf95o2RbOD?= =?us-ascii?Q?MOLM+RH0LGrmrgGLYACE/EnM5uEpxk+dyZEj+gWu8OnSC5uOSiS8ibyuoj1z?= =?us-ascii?Q?qxpDy5DOvIaUtbKzyMTcu1lJvMaMK9uirk3hhmWoizBvjN0WAQgG6olgDQp2?= =?us-ascii?Q?OF0rAlCX0X9EJp6l3yWsljd1J4FJJAZ87IRaMq+x8x7GEXQXTmHBfaUFSqJ5?= =?us-ascii?Q?YB7BUmegF88MiVJgqAf+YYSNH+ZPY4RJnajJjUo6nSObLhze+4IzUooHCEw8?= =?us-ascii?Q?3JGWS3cYL09WNr8mGUmj2gcsYl/emZcNk5yREgF56NiStR6f+zfo7W5UGvr/?= =?us-ascii?Q?BWf8Gs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= =?us-ascii?Q?WvclWSfJpe4k9D2JxhV5B3WukEyT5wtSqsEKyKDAc+8e/xW3e/NLvksKnETt?= =?us-ascii?Q?dcPBltSl4WiDdQluAx0mIfrKuwl/iCdijIA3XTVERs2gdg=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAWPR07MB9688.eurprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?7kVcGY1C3S18/8dSOonqD38ufdF6iCJJcZJSRVl/Kej74gj9Gmq1Q3q8Erfx?= =?us-ascii?Q?rdH3pQ0aHz0x0XgUPqU36M9aCQ3Ze9ok9tAQRcqwjSoXGo94aU30OV86du9X?= =?us-ascii?Q?4fxjQl/ZSwwDFNrOmVGC4hMlVIxyFRXh9sc3EAApCk9V2Fb2gE4T/bFoE4Ia?= =?us-ascii?Q?O37vOBJIyGi0trmrRG1gy6OpsEWfABkVgSGdaAh1RhcPHde2XwMYi/NdC7JK?= =?us-ascii?Q?3w9qPszruYAJ3y+604aBwFDU8dZQ3LF5MdYpV7wKiiQwYohOJOgsVwm7qcXV?= =?us-ascii?Q?mjsUujhFPkFCQvDQpXZ5xbG75d8//haEazufDKmFUfIeACEcM6TvBeP106OD?= =?us-ascii?Q?3YeP/jMy4zDnB4GYd7nXIm8M3ZulUKhcfeMHLZKfQnM3Kf+zEC3JE79vhuoU?= =?us-ascii?Q?pjrMdVMd7UGerVei9z/SCcnBXm+EIxYAfGgC12sOuoeVoMIWwRZ8tbaV9fD0?= =?us-ascii?Q?UVB6IP7/CX9nwr0nAsehxlEB0QrC99SHuUzL2EM7kIQPjgOz/WcMiGH5k/l0?= =?us-ascii?Q?JK/gI5IdP5OirxUk9twdOJicoWKjma7QhQMKa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bllDgQz+qZbMPfLsHBcSRK4FDYwTs7Q41fnVm4kJ0+5WnSa54wFmkcXDu?= =?us-ascii?Q?hZeP/rGw/LIr9i/waXxRZmgfLJCX06rtRTTQnS5RtI6sUkl+UJC1TjK3Ih1y?= =?us-ascii?Q?D1EilzWwr20JZ75T1FoTRrEaqat9pE1zOmU5YlPUf4jUFjkcBaS0IsK5LfAh?= =?us-ascii?Q?JA=3D=3D?= X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71892a0b-665d-4792-94e9-08dcec62b923 X-MS-Exchange-CrossTenant-AuthSource: PAWPR07MB9688.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2024 15:13:13.7653 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PC/+M4gwNIRAjKkUS1+FA5fs6LyzNvY+LwQuPeBWMVDvVSgFa1l6hG1qqpDhSrZcfqazfz0mi0MTlH5yVtjJPIixpG3LyAg/cvNYaZQ1jI0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR07MB8905 Content-Type: text/plain; charset="utf-8" When IPV6_MROUTE_MULTIPLE_TABLES is enabled, calls to ip6mr_get_table() must be done under RCU or RTNL lock. Fixes: d1db275dd3f6 ("ipv6: ip6mr: support multiple tables") Signed-off-by: Stefan Wiehler --- net/ipv6/ip6mr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index ecb9e86fe45a..b54353bee2f8 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -1668,7 +1668,9 @@ int ip6_mroute_setsockopt(struct sock *sk, int optnam= e, sockptr_t optval, inet_sk(sk)->inet_num !=3D IPPROTO_ICMPV6) return -EOPNOTSUPP; =20 + rcu_read_lock(); mrt =3D ip6mr_get_table(net, raw6_sk(sk)->ip6mr_table ? : RT6_TABLE_DFLT); + rcu_read_unlock(); if (!mrt) return -ENOENT; =20 --=20 2.42.0