From nobody Wed Nov 27 04:29:30 2024 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2056.outbound.protection.outlook.com [40.107.241.56]) (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 160E91AB517; Mon, 14 Oct 2024 15:13:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.241.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728918793; cv=fail; b=XKgS96kSHnvVkx7ivH9mRqj2S2GOKdz0bIAtAMI2Ktx8tDEQGehIR4Igj6SSViGY0iun0TKohXBp58mCLz4i0P2cyig04LNOUDDKZZTK9aJYqA7QwRhKd98zubEiA4qQ6+3t2C6AbP31aXIgTeIEuIjU8A0SRrFf+YeK6/iRWmY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728918793; c=relaxed/simple; bh=ib6Faai4OQRqmtopYKqjOO0SsweiMc5aOUhyF3/iuI0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=JnJdnyj+VxAqt0t8ch5i4wVqwaynXozG1U+s1F4wh+rYpbaLsQHwUl6pZsXvcCqtt4LrN1Fb6hk+kfr1PBKmFFCIxeBxwFb4jRXosVNhVL2kcraSwqBuEMnzDyoKkAokrNaXSmQpCgEzmu9IN4yCKhKI9yGZXnU9N/+Agz4Un5Q= 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=ELeGwVaH; arc=fail smtp.client-ip=40.107.241.56 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="ELeGwVaH" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EeT5XLWfnbqds7Cmog+9hqqeqX7uSIB7SmHLvDTvrzwARjNHeHgRfRSMiCxSNCx90RLY1V0B4gS2C3ehGiAqHnO2N2xMrNhMNmdfLKh0gr2AmrQN/C9qPw4hlq3hdYax6grpOxTvz/r7sZMs+v/a2/Nlv73IWfwPSuljdOpLbfAavyG7DI1UuMrsT/AlAAZ6HJ7lFNHB4/mypvyYgsKqceF0+PuZdOJZ4W1DrmwkrW5r+PoP/0HpOhyJpS+7D8PBv4NySiwIZEEK+PyEvz4Kid6v5heSIUtffcWx20cXQkrTQIeVFi9rUhz+lPoYFx+s13YAsPf5vihmbOyD6+1bJw== 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=9tWeL6x6otq58JBciWHLWg2V3W5/9/f7qlubIloiMjU=; b=HXEjJ8RJWxw1PML3m9xkODWeQYomRk4pskQu3irb3gSHXpz/SP78XLJAke7SGTihSyOTJVlzJWMxvLangZe7M/mIi8cKwmZiV7Fq0BmuZmrajbl0kcN6Zix6TCksHPMk6sZP/BA2PQSqupWRihIK0r3lf1xnPF2PuLNOtU8Jrai8zLqrWBcL+A2ruvDgnAReEQu7tTAsDsOhp8IzhGrc1WJ9qa7346EyUC/MESQ+yJPB7TZ3y7UOviGIBZchymZ8/XkzSbc0M/QeCxJX0cadcDHkBQmiI8nYHyLhNqjiE9g5H+VD4iyQRX8/o55m5CaHYa3XOlVN9H7JHW2gPpo4ww== 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=9tWeL6x6otq58JBciWHLWg2V3W5/9/f7qlubIloiMjU=; b=ELeGwVaHMEOAcoZXnrDF7C/d4xN/+oQAl0HeSL+Kg8/uzuk3htjYCsUlOL7dB2WS2to9szbtYHBXZ8sEHfP4fmY9yfIxZQmai1Itfx5HejiTHBNPJEskJ+XCMmvl9ZjDW5dV5J7On/8wOZTQC4Dl1vsbr4loV0b2B98Wv9lDyXbYDKk+K1ILtOvzTBp6YODOYJ3y7q9oKj3dW7YDiqsVX/Fpl+/O9QQ2PmhlrOFCejU5afmKPPgLT24N6vNmjrg5u8Z0JvM5HcN4hdE7OSgx8xv5yvgzZrbYGrOGpKUpBNpLjNvG7xA7Ue/c2n3H/aJCGN/bE2+hpgUD2woLf5YPCA== 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:08 +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:08 +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 01/10] ip6mr: Lock RCU before ip6mr_get_table() call in ip6mr_vif_seq_start() Date: Mon, 14 Oct 2024 17:05:47 +0200 Message-ID: <20241014151247.1902637-2-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: 6889c552-e995-4c3b-e8b7-08dcec62b5e8 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?FKELyt/cclV6SAxbE1RG85j/cFQy9sYksR3YeWhQnF6pmuExA+1fmxuV/Mlk?= =?us-ascii?Q?2UhSoSqxAEpKicfLvOIK7xM66xD/G8LBmlneE1hKBjtmTYxY09LZm73Tm4mz?= =?us-ascii?Q?4wS2YEh030Zu1uOV0QF7rhL8/MXKUhlfmkSIBCncS5AvkncCQEw2PSUsJ7r2?= =?us-ascii?Q?xbETp8dS1lA+AqS/FCosPDI+jP3HksA99NY4ORIvWsmeb1j1x2UJRzKXrUx6?= =?us-ascii?Q?D6Ezrq/dduaFa93vpMFRQ38ef4TLf4B4JSeB4INksnjkUokRiDQ220WQMEKu?= =?us-ascii?Q?M2PnmzzgUKrGRIoACiYaieYnQsIW+aPSEN5SLTd1ZZi2RBxMEWNxKmtlcQmk?= =?us-ascii?Q?xA7vec6y60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ewCz8dEfONs?= =?us-ascii?Q?kmokH0dUDpeuw1Nkxb3Sypfm7QeEoSKB1lNTtv7TenSr058f5px8GySrZTOo?= =?us-ascii?Q?DT1K4by6zx6P1/GYEuruWujjiigsyw6E+o6m+Oal4ajmTw=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?5HDNvlpxR5g+kZBVSiPQH01JNocLM5ppJuiv+CRYqul/8tKBuXqV2dDzQ1JJ?= =?us-ascii?Q?B0bLqj0ZS/VNrk8FqTSqoj9XZEZSrQUUMWVQpH/vpqow7IEkdXYtcdmpp/vX?= =?us-ascii?Q?0W/gaWYbd/+4xCExH0HGUBK0G/ExNPTUibJf+1d71oLSqRLYZ8V1SpntSFRR?= =?us-ascii?Q?U+xWiOxzC1EGPVdDwvyMdKVgC/3bAlkAcniGdFxkjIa+bqkyVjrDss/wLxUW?= =?us-ascii?Q?eAvg3745/i5CV2thIXbSfdJrvEHtTxEjWHqJY9hMJE5NbKMFLkGczKnzHuhn?= =?us-ascii?Q?k38Gkx5S9jOYWU9ViMIak/Cd75q9UqKBL/pPXcN1vdD+vEiCefRAWs7kXkHS?= =?us-ascii?Q?RF0FvuJO3RqLTATqXZ3HXDmbW4uDGcsBUoyj0o5pFC+V/vy4blsEYXdBANlU?= =?us-ascii?Q?ytLTxp0PRWtZG8h73DiSef9G6Lt2WuAp3bKWQ+b1ritzuQuhzEAIzF750ah0?= =?us-ascii?Q?qwM0hbLnrM4sqj3DG2w7lptIXYlOEewuJA8ZkGwDhvVHEJlf+RRTA4uTpuel?= =?us-ascii?Q?+kA65ubJg5zERbdXwEjESuMJ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qohJQhXoV7IuZn/OmzwwjG5wRvudsHBnIMxrpYx6IuC3aB4Hr/CmCT?= =?us-ascii?Q?+HFGvOFo+dvNN7PD8OZNuxJl4QTJfSPvbaWZTporwZP6aNdxBteBGSon1OLo?= =?us-ascii?Q?JSWZahgYfU8aEyAmW4IYViffS+MQmuI4y8Zv3I4IsLd85LsE/D+GJGExwpVt?= =?us-ascii?Q?LQ=3D=3D?= X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6889c552-e995-4c3b-e8b7-08dcec62b5e8 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:08.3608 (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: sKEKEXOcLrnK643H5gRvlJZMgaXgQD/90iK2DUlOWqg6gtJKEPqheX2oPs4oUwH+WYhL/C4qkrVIW3vT7DUyu01PmUwIi7QEeXyBMMNCRKo= 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. In case ip6mr_vif_seq_start() fails with an error (currently not possible, as RT6_TABLE_DFLT always exists, ip6mr_get_table() cannot fail in this case), ip6mr_vif_seq_stop() would be called and release the RCU lock. Signed-off-by: Stefan Wiehler Fixes: d1db275dd3f6 ("ipv6: ip6mr: support multiple tables") Reviewed-by: Eric Dumazet --- net/ipv6/ip6mr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 2ce4ae0d8dc3..268e77196753 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -411,13 +411,13 @@ static void *ip6mr_vif_seq_start(struct seq_file *seq= , loff_t *pos) struct net *net =3D seq_file_net(seq); struct mr_table *mrt; =20 + rcu_read_lock(); mrt =3D ip6mr_get_table(net, RT6_TABLE_DFLT); if (!mrt) return ERR_PTR(-ENOENT); =20 iter->mrt =3D mrt; =20 - rcu_read_lock(); return mr_vif_seq_start(seq, pos); } =20 --=20 2.42.0