From nobody Wed Nov 27 02:19:23 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 From nobody Wed Nov 27 02:19:23 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 0DD2E1AC427; Mon, 14 Oct 2024 15:13:14 +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=1728918796; cv=fail; b=FNOdI2n8E0MCGw9pRuKp9o2a9s7MGCMzVUCznI6B9SukoOpwvRSLaGyQu66Gi6iJA2BYO9SZ5yVfftIyIQlobQYtJ69eVjbwJKz4EBhwKSNpJjJr+jIsJjegIVq4gE/ywBic17+RBNoB9BYZ/SbgxBv+cwt54/Q5YGQ8G/BDr9I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728918796; c=relaxed/simple; bh=ZRwSxzEq/JG7RG85egQwcj7nqtw521c8nHnSOEiUfFA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=sjhKR8kuxZTb1H6GmINjb94N8MpieQhKgVt0ITERf6gaen7pu6N5NfhGIW494uERaQwggl7oJCzEoKfZs1lYx4mbXKOGl5xuQf31OauGBvBIKV1QQaCRqbZ3AQkkkVfMKaYz1C1uOa0IxsL3I7y9hjs2nZdUUnrytR7NlyZFeJ4= 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=FqiTNbqK; 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="FqiTNbqK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rHMuCvbItqJeEKB74hWjaZAMIu1Wo/SYuRo9TaVfXZF555qXwTwUZ1/1Pk/dYJVThEDjGJxmyFqnKuR9KYf23NTYQKwChJHcgDgBZYEAkAYHOPiJ4yBmNbg7OSUrHnYSaYxbl1IFfFLrjqgeWP6AwpzG2sUasPyKgjiVNgdLCPmS4nMOAAdvit2iHVjvlKALfhztXFFDRLoTYKQPfbuEfz4mkIYcFyvXou7y+quAIlciD1CRuTEzVZ01/dGMtoAk2XbLTVX4mLMDKYdCvH2r6Ekcwgf97W0pcHV2vzUVjHjkZbD23aTtqS4USfgSd9AiJ0F0CJ9NF6C5l+sxt+vNig== 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=DvDfLSpKbVmCwX1prww8uQeglFjudRba0RVIrk/XYZA=; b=TUlPvG22uCc4r+K7MH7JJ52ZHoR25TlsU0DZRbUWTUwvycbsjepubo/0hoXWyVp0zK3TFb2kL7YHqGVPuh0abXie9d0xg5RFJi6ChvzFWautQQ/M0MwEJ+ovGtFdkGlFs4bE+vYAhH3nmdkiKfXr40lq1mO4dV1drvSeDDi1sdAEOYaYrAZOACi80I+nmRrB/IHBklzo9XdGA0D+V9CZGvBBRrH3jVOC6Zf21kJMpZAC3J12FYTr3TlTkJ9mrYJEiuzUF7OGl5OQ4VVA80BeSnXUY2GlCT1vjOTEhqvD2YUQT3dlct/J3Jpmf7AgWyl3xyc729LH6LDjrEX6TUxqsg== 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=DvDfLSpKbVmCwX1prww8uQeglFjudRba0RVIrk/XYZA=; b=FqiTNbqKxfI72vT1E6XQ6vYCHEQFr3CnbB2u9b9IPFnt2GYPlvzURSfhjBz7MPGe8shf86Ektr20M+dF0Q8YJx9hB4NzeuLgBXkzetGnrPVmhCUNZGCBsUpBzPmufnNAU3tpS3uZd+Tk8cyNt4Cp4VJ2KbxqDH5uJh5X0hx3LMCUUXJDSJPSToD5GNLcB1vSeuwPkEEisGxgXIYIIV5lw+hu5ZivBeNXh9KD8trfij4Am748tBiZXloxECJudHSIWVIMlz43Wq/Fu9AXm1mdKVXaaOA8jMA4f6bwRuO+bk6A9i+aVoe5CQEVKx/fWmpildbJkKoZ/dsXS+g+IniZ4w== 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:09 +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:09 +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 02/10] ip6mr: Lock RCU before ip6mr_get_table() call in ip6mr_ioctl() Date: Mon, 14 Oct 2024 17:05:48 +0200 Message-ID: <20241014151247.1902637-3-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: a4265647-a31e-4609-a85a-08dcec62b68d 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?2IwcTYabDFPdGOefU7RIbqA8Ip2Dk8QGsnTuXZE2kZNMi9zuJgBrA1zm/jH8?= =?us-ascii?Q?8gYujU5HRSu3ZV+Y1ePqCMEJrYlpqtQhrYDtJIf8deyf0i/BX7MfIgg1xo3u?= =?us-ascii?Q?m4iuVpmbGgHLVW/uaMrzWIjZVNLaF7XWdDF70SjP1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boSmUBoGNS4J4ayRdKOy5c5GS1WjgdJBt2wk4oX3KNmt?= =?us-ascii?Q?GVcvweaMEvNx8tmttBLNgy3kesBYOdNFt8vJ/O2ZPSptFi3EkGVQltWtvx5g?= =?us-ascii?Q?OsZpyJai/Md1xvMtymbmoTXJpBoHxYwiWj8ovbIxGqNyFQo0r0+UhpiIj9NQ?= =?us-ascii?Q?VhojkyHIMhmnHX+T4ZPQdfC3JCWp4GgzEC3FWMtDOsXWxDDRAM00uEQGbNsI?= =?us-ascii?Q?LKCZRBzjGURxCSydVC+WRYIfqYo1Ynz1OUjyoFN9zIvWWnpsUFbrvXiBbH5J?= =?us-ascii?Q?/E2kA3PA1KD2Oh76OJvG0Hsh5DjD577ebKExiW2G5QxoUg=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?/iI5VU05aE4xUKTSI7hdVOZwPq/8caqBtl4x7mjCxc9uyjY94pkfCdigBCEt?= =?us-ascii?Q?6ursWS502zjuoQPL3jFbNokR3t6N3Lm+tRtU+Ro1QXBE5t5nzuroKGgvp9I5?= =?us-ascii?Q?ZVOQ5ze+WwtzQIM9Y88xsnxbVOpABNDJSzOW4G4yXrXMpibUWjrPL67Xy6HV?= =?us-ascii?Q?pTVZdfCUyN89bCfkXZg2v+TAWQhGqTxUEXS1S5BotRXjNG/+0ygC1zlRnxwB?= =?us-ascii?Q?CS7+DfPViTmYDhrRup9uGmortdyGzc/NybBmcdKyFTeNS4KmsQE63vYBSJ2r?= =?us-ascii?Q?whLfvi58dORFi/Teny+MinShz806P27wcY9CN2u+1mJgT1JaCMGSgFOJCx7x?= =?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f3LGaEvODSXqUETjm?= =?us-ascii?Q?amCYveVmgJPRSJ27k/+iPnICKqjJ1929rN1nAhtxgQimKtPSHhWeoledV9EP?= =?us-ascii?Q?Pf67Ss7Gyl/iW0GTVTOzHM3K2f0VKOX8hMT3GznTT1wFEg5tlqTmMfmvwEpU?= =?us-ascii?Q?uRzTnuS5S3pzdi6CghpiC2587lzO+PBwMTJc1GKf4/7Uhb9Ov8pVRCL4CZRE?= =?us-ascii?Q?90Qik9+At6SeO2X+o2S4fe9MrVfWsewZE7OwhKjCWhhoeM6urmDZttE/c5kI?= =?us-ascii?Q?xls9/D/OlS30FbEuXcSOkIOUJfqvlO/CUsauWTSEUFMql60IPowoWtm1gxfT?= =?us-ascii?Q?QmkFgOdgtasF0kbX93tzyV5uOf7/Vei7OTKVNOqeoEIguqF3QtHQ/JaSjrOx?= =?us-ascii?Q?ag=3D=3D?= X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: a4265647-a31e-4609-a85a-08dcec62b68d 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:09.4064 (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: rSPYXVaXASJmzX8cKnLzijq8E1FYc/SI5i3LBtzs6KQcZW5wyBhen2CPzH+TEn4wKenOlCqVmHiVTLvEqJZemNdI5XT1IyYSz06FNxWnUFM= 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. Detected by Lockdep-RCU: [ 48.834645] WARNING: suspicious RCU usage [ 48.834647] 6.1.103-584209f6d5-nokia_sm_x86 #1 Tainted: G S O [ 48.834649] ----------------------------- [ 48.834651] /net/ipv6/ip6mr.c:132 RCU-list traversed in non-reader sec= tion!! [ 48.834654] other info that might help us debug this: [ 48.834656] rcu_scheduler_active =3D 2, debug_locks =3D 1 [ 48.834658] no locks held by radvd/5777. [ 48.834660] stack backtrace: [ 48.834663] CPU: 0 PID: 5777 Comm: radvd Tainted: G S O = 6.1.103-584209f6d5-nokia_sm_x86 #1 [ 48.834666] Hardware name: Nokia Asil/Default string, BIOS 0ACNA113 06= /07/2024 [ 48.834673] Call Trace: [ 48.834674] [ 48.834677] dump_stack_lvl+0xb7/0xe9 [ 48.834687] lockdep_rcu_suspicious.cold+0x2d/0x64 [ 48.834697] ip6mr_get_table+0x9f/0xb0 [ 48.834704] ip6mr_ioctl+0x50/0x360 [ 48.834713] ? sk_ioctl+0x5f/0x1c0 [ 48.834719] sk_ioctl+0x5f/0x1c0 [ 48.834723] ? find_held_lock+0x2b/0x80 [ 48.834731] sock_do_ioctl+0x7b/0x140 [ 48.834737] ? proc_nr_files+0x30/0x30 [ 48.834744] sock_ioctl+0x1f5/0x360 [ 48.834754] __x64_sys_ioctl+0x8d/0xd0 [ 48.834760] do_syscall_64+0x3c/0x90 [ 48.834765] entry_SYSCALL_64_after_hwframe+0x6e/0xd8 [ 48.834769] RIP: 0033:0x7fda5f56e2ac = [ 48.834773] Code: 1e fa 48 8d 44 24 08 = 48 89 54 24 e0 48 89 44 24 c0 48 8d 44 24 d0 48 89 44 24 c8 b8 1 0 00 00 00= c7 44 24 b8 10 00 00 00 0f 05 <3d> 00 f0 ff ff 89 c2 77 0b 89 d0 c3 0f 1f = 84 00 00 00 00 00 48 8b [ 48.834776] RSP: 002b:00007fff52d4bda8 EFLAGS: 00000246 ORIG_RAX: 0000= 000000000010 [ 48.834782] RAX: ffffffffffffffda RBX: 000000000171cd80 RCX: 00007fda5= f56e2ac [ 48.834784] RDX: 00007fff52d4bdb0 RSI: 0000000000008913 RDI: 000000000= 0000003 [ 48.834787] RBP: 000000000171cd30 R08: 0000000000000007 R09: 000000000= 000003c [ 48.834789] R10: 0000000000000004 R11: 0000000000000246 R12: 000000000= 0000003 [ 48.834791] R13: 0000000000000000 R14: 0000000000000004 R15: 000000000= 040d43c [ 48.834802] Signed-off-by: Stefan Wiehler Fixes: d1db275dd3f6 ("ipv6: ip6mr: support multiple tables") --- net/ipv6/ip6mr.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 268e77196753..2085342c1fcd 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -1884,47 +1884,56 @@ int ip6mr_ioctl(struct sock *sk, int cmd, void *arg) struct mfc6_cache *c; struct net *net =3D sock_net(sk); struct mr_table *mrt; + int err; =20 + rcu_read_lock(); mrt =3D ip6mr_get_table(net, raw6_sk(sk)->ip6mr_table ? : RT6_TABLE_DFLT); - if (!mrt) - return -ENOENT; + if (!mrt) { + err =3D -ENOENT; + goto out; + } =20 switch (cmd) { case SIOCGETMIFCNT_IN6: vr =3D (struct sioc_mif_req6 *)arg; - if (vr->mifi >=3D mrt->maxvif) - return -EINVAL; + if (vr->mifi >=3D mrt->maxvif) { + err =3D -EINVAL; + goto out; + } vr->mifi =3D array_index_nospec(vr->mifi, mrt->maxvif); - rcu_read_lock(); vif =3D &mrt->vif_table[vr->mifi]; if (VIF_EXISTS(mrt, vr->mifi)) { vr->icount =3D READ_ONCE(vif->pkt_in); vr->ocount =3D READ_ONCE(vif->pkt_out); vr->ibytes =3D READ_ONCE(vif->bytes_in); vr->obytes =3D READ_ONCE(vif->bytes_out); - rcu_read_unlock(); - return 0; + err =3D 0; + goto out; } - rcu_read_unlock(); - return -EADDRNOTAVAIL; + err =3D -EADDRNOTAVAIL; + goto out; case SIOCGETSGCNT_IN6: sr =3D (struct sioc_sg_req6 *)arg; =20 - rcu_read_lock(); c =3D ip6mr_cache_find(mrt, &sr->src.sin6_addr, &sr->grp.sin6_addr); if (c) { sr->pktcnt =3D c->_c.mfc_un.res.pkt; sr->bytecnt =3D c->_c.mfc_un.res.bytes; sr->wrong_if =3D c->_c.mfc_un.res.wrong_if; - rcu_read_unlock(); - return 0; + err =3D 0; + goto out; } - rcu_read_unlock(); - return -EADDRNOTAVAIL; + err =3D -EADDRNOTAVAIL; + goto out; default: - return -ENOIOCTLCMD; + err =3D -ENOIOCTLCMD; + goto out; } + +out: + rcu_read_unlock(); + return err; } =20 #ifdef CONFIG_COMPAT --=20 2.42.0 From nobody Wed Nov 27 02:19:23 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 4F0841AE001; Mon, 14 Oct 2024 15:13:16 +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=1728918798; cv=fail; b=LFLFDMJBrG0dAIHTJkv6d1fDYCiYFzJcdZauL/GxDkQTnVf/tDhRDJEQ4CEtkgToXdkIzgRuN7PGZW/YfCThPMzuw0UgERZrreXF36woEFpfezxzBz6ztWU97oeQor3WjVc4d8oq55XqPvI83OQdRnA6N5aSfcR0GeNgwV0jijA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728918798; c=relaxed/simple; bh=H8HZ8k8sgBQxl39lr1Vh1RDT8rQmjhbNuEaG8tfZdJ8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=KRq5eGDc9EJ8MLQEXv+JAj8zIMtwua7ey4wE0capWy4uUjvk85OSvMMDZBzOTOe75bYWzC4TlBtX88TX6Y07rckNLF9SsLJL1bjQoQmMUj1SzX/qwsQefB0kL/nEGfavW1eD+jRjOL2OyTwoi0+aejxJgxCYvnXllny/f33XVuA= 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=B7qodzMs; 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="B7qodzMs" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SypPQ108WptxfXD0SqdxZlzTBppLTclez3C6f6fA+/KDlUWLCxmxhpEiJpK2Qm/QvxRqeY+w2nEPYJ94wLzEdBBN691Y4FqswcmxnDH+ahoz+zWSX62j7dGjjSx348MV52D7Ynr/2HdCkzpUPgTpP3hPbH1pG7XpA2LzZyet9K+LOlqK5HzrRhrqqvsjt8M67XSHGxI36dmj3bZzGgYxUH4r2q+ZXiBgbIVIXDbrQZxDTda/rQZp4S7a4+iDXem8Id/F+hg/zzGwzNfrZ6EGyNCSqMf7afEOkCgAwePIxvXwj6NLVDvMY8naAwnC8e8Y5oGTYs0/S+IO2mVE5CN6GQ== 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=jiVi8tUiW0odjPphqccBtB/TmJHet0QExhsO6ZRjgl4=; b=hQxqLpWZTyP+3O01+nstv6TazDvVMdOmRbSXVCxyLsjY007fmO4TcIQqoXJ1WumRwexN9J53OQdcD3qfr4jeqpiTL3yjZ5iY4WbDGQogtG0m3stL1HPYF97fdm33cEEg/A85VeHmOhl7g+p00g6AquBrcwM/+4Qr8bfsCKwJ/lCmDUPGS6cADatSNkxVrrbIQ8oCy/x2ID/Vc5sRoaB/0R251zPqOf89vVznrmjgU6WoEYeDQ8osljytvkFb+9EfS6K2jPO4833N6TRiBHCH3gUtcSyXg7ZmnQIv80NS3KPUDH06pJuHZvPAk9a243qa8mr1KR8ykWuIocN8XNCRkg== 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=jiVi8tUiW0odjPphqccBtB/TmJHet0QExhsO6ZRjgl4=; b=B7qodzMsrWwoPqnoFo2Vp1w+CNj4V7qmz372p14I45HCLuloUVR3RcSRe5NL0h4mAuAM7NMnLYxtV3SCKRv3h6S1sviIG2bHwMoeKmA64P+3tXM/7DFgVU8aDxtn59eBlIJalRajGLTbo9ARhYid2qLkEv/ABvrzyW9NZl4WJRxfr8/c4QMJJDt9wR20v8b1kDvN9LbqSt4l+/pZ10OZC5Hjotaqo1w/ohZQdM6XZI1iU+oXdJ+iu1sgMhlp5AnTwlbsA6l9PHosz640X+nYw/Lh1wu1BDNTKC+qGFBfPvqC2bs7A2ObUhgjOtKtI+XBo5uw4+Ql5sSfY6v6LDMAFg== 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:10 +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:10 +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 03/10] ip6mr: Lock RCU before ip6mr_get_table() call in ip6mr_compat_ioctl() Date: Mon, 14 Oct 2024 17:05:49 +0200 Message-ID: <20241014151247.1902637-4-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: ec3dc677-6ab0-43d1-29bd-08dcec62b71b 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?swv8TBdOurM6px9FbFLPTYbk/mcp/2IDB658NLzS800cgP566ObcmssL5/Ek?= =?us-ascii?Q?MJNPpxV9a0I4PQAcca3HU4C2mUu+cmsdzWqcW6JTotZowuTzZzcPl8iku0St?= =?us-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GIACEhJBhsMd92YmNBqOJFZA67XA6Sb0?= =?us-ascii?Q?izTwssvj9yH8ZGQeAhOm4pHPAgU4jxQg2P6It0HZllDfJkZI4FCMjhNAcEle?= =?us-ascii?Q?KKX1M+BkfO0kJIxm88cu8Xcnd9RSNVt32g/zg04yE1+w+6y9gJHCS3glz28j?= =?us-ascii?Q?VwSSF25r/Ps2GhZmmcSvaJMZk0vmdBP8nJ3Mk1joaAoHw3DTa/Ok/j6MBggl?= =?us-ascii?Q?gInr2llCN0C43ul1doA3KLpjVyGaQzURs08UidBnT7dFNJq22+oa5C/YmjT4?= =?us-ascii?Q?YeBAdSIrtWfYf+uNpoVUESAWlWQM7KZD+ixCOTWRJfSHgzHng8zvnPJa+ygs?= =?us-ascii?Q?Z/ODXKMrTHBV5Jec/3/59Z3y7OZIvbSbsKGFNAkaU/Pz+Q=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?sOfGuPJfElMz3jtosIeaFF4OYX8lvEoY/AFhNEG9sZUXYcpuXD+WZ3whgNSR?= =?us-ascii?Q?TxfBEd0mU3KdsuLrQ6aBfiasImAsjTkcf/mK5XgLc2ZcYEcURSIsuNJYQmaq?= =?us-ascii?Q?H1UHuZrMC4hQQMFk3OOo/1gcOqC62CJI9DbKGOtqAGfoXdtqzz1+HX/wFQh2?= =?us-ascii?Q?N7dQk9kutpr1JcZ7Q43D9sQDbAwGtv1NVqvuOtjwYzzYnqcI+JL8JFk58nv+?= =?us-ascii?Q?/IMYejxRvgCAEJ5Woulo5N2Yw0Uax9r33PXddIJcESxluo4EW01fm0tXsxib?= =?us-ascii?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fjSHyUwy5uJ?= =?us-ascii?Q?IX3kSrsyfXA92rrWIGfPBxiIWXMPj6gS4YSljCd6BgvqxI8EF2dmcPqIZ74V?= =?us-ascii?Q?fsuf/V2lTvTNrE+lMlsmf4xFU2EytCXu1mI4WA+MfbOP9WtKTwQ0h2EXdHa/?= =?us-ascii?Q?BvDOq23xVVMqZIn/f5cIpQvrHILMh/BArHMoNJ3vAYYd/4dlabCFWbsrtqTs?= =?us-ascii?Q?1uZ2LcItq5e7Rp8PtpjBZMNBZdVlyesjtZog8KUNbgeiYuQAzjXIg7DyuRMf?= =?us-ascii?Q?DheFqmn9KOjFJ8DuMmoHdSfgRP7+Bn2gGr+GmZt45oCKIFfw/kjH8PS71wPU?= =?us-ascii?Q?p+ojyvru7RpWwCNls9Gl3ch9Vlmxdat5/P0GgNamQZL+5mjPc21QkE/EAg38?= =?us-ascii?Q?lRmPgfrSLD9b4vC43iCtY5ZlTLehUaHmKOzaJYR5mmBlT0NQlkXwVDnPLV8/?= =?us-ascii?Q?YQ=3D=3D?= X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec3dc677-6ab0-43d1-29bd-08dcec62b71b 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:10.3713 (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: rumL+390CUhLL68Z1C0KNpT34sUPr7hylH32Nsaxir1LVAUUE8TyLhGWB3aR1KJWOXPMeeVjM4YjVBYM/MjH3T4TOZLWTpyF1/q87zHdKFY= 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. Copy from user space must be performed beforehand as we are not allowed to sleep under RCU lock. Signed-off-by: Stefan Wiehler Fixes: d1db275dd3f6 ("ipv6: ip6mr: support multiple tables") --- net/ipv6/ip6mr.c | 49 +++++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 2085342c1fcd..b84444040e0e 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -1961,19 +1961,36 @@ int ip6mr_compat_ioctl(struct sock *sk, unsigned in= t cmd, void __user *arg) struct mfc6_cache *c; struct net *net =3D sock_net(sk); struct mr_table *mrt; - - mrt =3D ip6mr_get_table(net, raw6_sk(sk)->ip6mr_table ? : RT6_TABLE_DFLT); - if (!mrt) - return -ENOENT; + int err; =20 switch (cmd) { case SIOCGETMIFCNT_IN6: if (copy_from_user(&vr, arg, sizeof(vr))) return -EFAULT; - if (vr.mifi >=3D mrt->maxvif) - return -EINVAL; + break; + case SIOCGETSGCNT_IN6: + if (copy_from_user(&sr, arg, sizeof(sr))) + return -EFAULT; + break; + default: + return -ENOIOCTLCMD; + } + + + rcu_read_lock(); + mrt =3D ip6mr_get_table(net, raw6_sk(sk)->ip6mr_table ? : RT6_TABLE_DFLT); + if (!mrt) { + err =3D -ENOENT; + goto out; + } + + switch (cmd) { + case SIOCGETMIFCNT_IN6: + if (vr.mifi >=3D mrt->maxvif) { + err =3D -EINVAL; + goto out; + } vr.mifi =3D array_index_nospec(vr.mifi, mrt->maxvif); - rcu_read_lock(); vif =3D &mrt->vif_table[vr.mifi]; if (VIF_EXISTS(mrt, vr.mifi)) { vr.icount =3D READ_ONCE(vif->pkt_in); @@ -1986,13 +2003,9 @@ int ip6mr_compat_ioctl(struct sock *sk, unsigned int= cmd, void __user *arg) return -EFAULT; return 0; } - rcu_read_unlock(); - return -EADDRNOTAVAIL; + err =3D -EADDRNOTAVAIL; + goto out; case SIOCGETSGCNT_IN6: - if (copy_from_user(&sr, arg, sizeof(sr))) - return -EFAULT; - - rcu_read_lock(); c =3D ip6mr_cache_find(mrt, &sr.src.sin6_addr, &sr.grp.sin6_addr); if (c) { sr.pktcnt =3D c->_c.mfc_un.res.pkt; @@ -2004,11 +2017,13 @@ int ip6mr_compat_ioctl(struct sock *sk, unsigned in= t cmd, void __user *arg) return -EFAULT; return 0; } - rcu_read_unlock(); - return -EADDRNOTAVAIL; - default: - return -ENOIOCTLCMD; + err =3D -EADDRNOTAVAIL; + goto out; } + +out: + rcu_read_unlock(); + return err; } #endif =20 --=20 2.42.0 From nobody Wed Nov 27 02:19:23 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 004291B4F2A; Mon, 14 Oct 2024 15:13:18 +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=1728918800; cv=fail; b=iUIj1b701/v/b2bez6T7aRmCj2da7l5jTjwVC+cTimeMM4lmfDAWyNXifPVMCXmyybS4YUajJK9XFxLvixiW5oJ+9ID9UXfTTptIxL/Hlk8SZwR85uelm9kjwPIJHeW/PV5+IQEVwMbfQWxcdON299FvDa5+2S8vmEl+fkNYnrE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728918800; c=relaxed/simple; bh=tJ0iyqfaOtQhRg/d2qxFxSh1uZbPrtp8Mj+lzr9CT1o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=JthUjULtpv/C5wO2wWV4YQZKT5/Sh1p7uAqCkp1Y2ORGQx+w5X7q2K688YhcxBGTdO49ayfNFd958mbR6t9PdRSanXFuN+OrvvcGtvKEzgKmqyRW3cLhDsP+eiMwQXal24tNTz+h2bgs9cT2k2DkBwEApzbtDkLzpNclogmLVEY= 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=Ln1Xrtia; 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="Ln1Xrtia" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=p4ky0UKhAUtgmDmMTWRt4rtgAI818ep464tBxrbH33ZM6mTswKmyQs7PFaKGKj7PAOtsERFUSh3M9e8VucmbuRXXqexC82yQG7nv7oK+QQCIOPjFpJL3XENek5wTgnhYSpbjfVtqheccQyE3XnFLpUFgnZDMhr8sNpdMLpaekSalce+eyWoUTYfY+UKbv0MWHhGxNv8zQbth7VaI49OQ4PC4gCchKeySniPrS7NKvKkfPlTRRH1TyqrdQU4MyW4Lkxu6QvIZXvIPZlstV+zxnTcS7gxXbDvRhfV+dyfBzSB4L/ozhFWZ2435YgrprkDUXYFXZdu3am6aRQf3kcE6eg== 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=UlFliFYEiT2k20zUehCmEE/OTyU+WRGiVUdr+buZxY0=; b=KIzxc4GQF+5gm06ShogoyZr2huTv7iFkalpTzD3L6gERbwJtCy3zPaNINIWvThDOMok8xiFvNS/fMAkYfOXZXUaUUmEXQ9F/YeTFlQ7cbTVcMXL0DX98J74MSrZTjifOrt7d7akOjViXrEQXpFQqL0/7wSVbMhHNrFR2PIGEgtpWZUqgOfVRCzIE76SukqOWx0oU+CWa8yTnkTpq5kYPit61QzvbOtEzlwEB6zrmppeagTp73a2E6AjHw6S2A7l7vr9IWhi6GUA1jDp3Lywdu3dZuUKd3Z+0Wwr8zGmDIfDoGS7AAjPpdRa08hixUAioRPNtN4MVrAWAWTw5uWqpfA== 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=UlFliFYEiT2k20zUehCmEE/OTyU+WRGiVUdr+buZxY0=; b=Ln1Xrtia/RcQNnaNklYXDvjqmEo3hnhHmTqNr8MgHFdKlEaKCSWJPBH6eKOHYBnVHxJDC73tV5iGJwyrYhp6HpaX/C+nq/zIqReabAyb7MwnlBGVNCF8esdAVyE9w7ESWnpF44+OVKQsk/sfZqo0jgZhiwsvdC9EXqSlcrs/7zSa9+ycvr7PQz26YWIwmKS1BGFn0VO8itEFIgRAIh7KuOgq/5yK/RqiVwGLMa2L5DXsZ9Nm/Zr5ehK5WtF7n6C0Ep2OeVtUxen352Q2xp564w9LRzjccORdjjlD1X+l3h/BtUjak3FYfrk4Q8Rb7rAIe6lWXWtrmFIYlv4FhhMSgQ== 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:11 +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:11 +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 04/10] ip6mr: Lock RCU before ip6mr_get_table() call in ip6mr_get_route() Date: Mon, 14 Oct 2024 17:05:50 +0200 Message-ID: <20241014151247.1902637-5-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: 87854762-5e76-40e4-c80d-08dcec62b7ab 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?EpCGuT7sRxDmEgbjlRpahncOukYHFYzHAlR+ku+wizoT6ThbLvvk32AxAwA4?= =?us-ascii?Q?PZmpla8ttm30J066E5s1Ww2i9dwRVM8iZGMYZWB5L2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GH9FrYjGNvuTnyakcf8Wl9SAFqAja+bKpT5GAouWXA2zuANgC?= =?us-ascii?Q?1HSb1DqSGeAbYgVwHHWqtzvaw4xBIO7YmP0p6okCFfIN69mTKeRcogvx5ipd?= =?us-ascii?Q?wI5eXeE2Y5beA+ulEg53vJvcpFUvQahtqqdKZZy1DL/PEsXFVOqPsKPO6+E+?= =?us-ascii?Q?TtogrCGtcw2jYOT3WJIxl2QV0leoRL/xnrvPNJTY1pZBWnnDp2gS2G6pJTzl?= =?us-ascii?Q?Rfy/BOqnlDYT73x0+HL97o/J6ZcbBc7FpDl30efaGSF92AvqTV1btQvNq8Hb?= =?us-ascii?Q?mCACJoEfwppJ6fPO+LdXdBIbnH6/VNXazHBsI9ccPcWL+evOTX36T8Y2BWU6?= =?us-ascii?Q?EtFRNahJuD27mPdThmxoA6tclWSkqEZs+LxgXDaYzIBoGQ=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?tjvpMTMi4knnqH1Qh2vdBNMqKiDFoYnm+Oj0mf8MxaPQyk2D+3LAYx93tizy?= =?us-ascii?Q?HKpQoUD4t9xDhbO34+q43u3YSjVdHZ5CmKMhXoyLOvRczpDcjn3qZzvXbNSc?= =?us-ascii?Q?oAkYbeH1NJNo3Q4YMgAne4MgXlAPpznYuUSXbgzhMx2ucbJ54BVUneUN1DIe?= =?us-ascii?Q?Q0CKRv4yIonCNDdJbRLpZHP9pgGVHD+JnTDTJ1CknTLdElHVUD8eoWSEexZP?= =?us-ascii?Q?FqyTDaERDvfiLrcDvkAodW76MNXDTpvsBFofILc59a/9sosd/WhzAHnFvexf?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ESXidbx5jPODCG5e/nhghPHshp484SO5?= =?us-ascii?Q?gzP9L/Ju3cBBaagZdPboawiGYe1k4FYHsuHBqOqsTF7GZAvVayAPwru53MsE?= =?us-ascii?Q?RHTfpSmOHnI7woUWSzuHpBaVFNoYgStNPEhTn1/3w5zZma6g9axLzzvwSIat?= =?us-ascii?Q?koK1SaAaVh14Eh7lVZs/M2VZTK9VgvCPQYiL7PrcpVN1DReo4UqyShJHmn4K?= =?us-ascii?Q?WZ+jf9FhING15R4VvPLOlYL5QbRS75Kbwr3ackaKlCjkrhlZYdnQP4Xbc/4h?= =?us-ascii?Q?+QHFtMn/DVok9DPZYf6nWGMLCA3lsSwUkUE2f+4OcnYyn1B2VoroK6Lv1EkM?= =?us-ascii?Q?Os4wQbmXNbeh2uw7TJmm2j7HnBu9ED4+PtTqC5APdXI+Xlyui4zv+k+OhNSX?= =?us-ascii?Q?TxzYBZB5OLgog/DilOhGkVSeeGQFJNbmQxK+fsMTCE3avA6wnrKTav1u0VS8?= =?us-ascii?Q?yw=3D=3D?= X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 87854762-5e76-40e4-c80d-08dcec62b7ab 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:11.2922 (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: abMmGYw7tlvMp854e9owZmIplsbRWeHNoZVf+HxOdP1y4NMDcUv21/WzuV7C5MJGmWZrL3V4ONoWxeGzBuJixpUPt5JP46QpF53JTOeadkk= 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. Signed-off-by: Stefan Wiehler Fixes: d1db275dd3f6 ("ipv6: ip6mr: support multiple tables") --- net/ipv6/ip6mr.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index b84444040e0e..c47564f0c868 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -2299,11 +2299,13 @@ int ip6mr_get_route(struct net *net, struct sk_buff= *skb, struct rtmsg *rtm, struct mfc6_cache *cache; struct rt6_info *rt =3D dst_rt6_info(skb_dst(skb)); =20 + rcu_read_lock(); mrt =3D ip6mr_get_table(net, RT6_TABLE_DFLT); - if (!mrt) - return -ENOENT; + if (!mrt) { + err =3D -ENOENT; + goto out; + } =20 - rcu_read_lock(); cache =3D ip6mr_cache_find(mrt, &rt->rt6i_src.addr, &rt->rt6i_dst.addr); if (!cache && skb->dev) { int vif =3D ip6mr_find_vif(mrt, skb->dev); @@ -2321,15 +2323,15 @@ int ip6mr_get_route(struct net *net, struct sk_buff= *skb, struct rtmsg *rtm, =20 dev =3D skb->dev; if (!dev || (vif =3D ip6mr_find_vif(mrt, dev)) < 0) { - rcu_read_unlock(); - return -ENODEV; + err =3D -ENODEV; + goto out; } =20 /* really correct? */ skb2 =3D alloc_skb(sizeof(struct ipv6hdr), GFP_ATOMIC); if (!skb2) { - rcu_read_unlock(); - return -ENOMEM; + err =3D -ENOMEM; + goto out; } =20 NETLINK_CB(skb2).portid =3D portid; @@ -2351,12 +2353,13 @@ int ip6mr_get_route(struct net *net, struct sk_buff= *skb, struct rtmsg *rtm, iph->daddr =3D rt->rt6i_dst.addr; =20 err =3D ip6mr_cache_unresolved(mrt, vif, skb2, dev); - rcu_read_unlock(); =20 - return err; + goto out; } =20 err =3D mr_fill_mroute(mrt, skb, &cache->_c, rtm); + +out: rcu_read_unlock(); return err; } --=20 2.42.0 From nobody Wed Nov 27 02:19:23 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 591161B4F14; Mon, 14 Oct 2024 15:13:18 +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=1728918800; cv=fail; b=LfR4KuJ5O1vDTNBYMeqe8n9vVvdi8iwmXinJFU4pGo/ZVRWoWBGKcKdLUZRd3uwmjLhNle2FqEG3ARNqSNM5gZctIH0cPEHd+4rx/vlWIxvj1WyVY7+auaoiIkdzooXi2lvdwPXYl+7GDdoXoiUD39fP9Y4iQ/POIXK9CLrMZ0k= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728918800; c=relaxed/simple; bh=Sro7sFxX1Dl+c+kHUEOB/UwzRmqFmvsQoikgx+h+igw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=rqdZ+qE3/0xB62T4/108IG853G+vHgEWR3y7uWwDAxS9HgErhDW8y6fpfzmNd9edglbf5OnAeuqqWR3y3l3dsmuJSXXJr6U0GPJxOp/xjbW/IGwkOXNGZaGGfqPiHEIFJEKyOMXjIlSqf82HbYw+nPyI+rxGC0in0wMrDiboMk8= 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=OSOtKaHj; 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="OSOtKaHj" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rBQh+XKLXfNwMOpN8jO89VCw4Rqa03m2Y4QPJSgXwMaOv+JDHxqjLpRm4bIrZD2EB+DVi++IdCEVxlAh8SMoH88TQVqIUJe8JTyxMYql1DSoogCCJUXVqIwZza1495wZjqg5FSSbCEuCeVSJq0fxdkURODYwomlHiDN6xWLvVQh8VaVFqfSQGh/AufEOS65bZuUGgdM8eMpdoUfvIGsZOxIjmgyJPMPkyVGT2kltMTHdYBkgtQIqunkOcrfqaVtf3yP5mJTbQupADtbxY6SnoSHR82MNeuK5gK9M1MvJdpiEGZ7V+C+CUR+CV5rN3v56NRknUxxqgnuw/GGaTdSvBg== 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=ycIg+E/wpAnSLvZg1OcUiBoAyq8QQYUbe/Z8/03mWcM=; b=DYbLtfExWt+aVq4EpsQab/NbIhKeNGTa90G2L41IT0QjzoJ4AAKT+iCzxJqH4GoiC3OCMGUsrgK4yW4KpTU5zIeyclkMYJdBAMYPX13VpgoKoYbniFhn3ZLjGjP0DYKWwdJLEEZrqzHei3LiJaFLI95Yov0CskgwctzQWfKmiPg8R7yhfyT+3VV+VQBrNdKrH2a5B2CDWL93sgtAzilBOICTq/6W3W8kTBYcZjD+8xiF+pygkASHE2HiofWMUCfZyt7luyxMijFIFeBm0BBTQLfhnbUxC9l2om4uG9VssHvDeK07UHSi3498Ep0plCQMabfdkQTOG1vvsBNjNSoRTw== 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=ycIg+E/wpAnSLvZg1OcUiBoAyq8QQYUbe/Z8/03mWcM=; b=OSOtKaHjmA3KL02h8d10VrpBzYmRfjAn8YVSarDBCDA3hGH2dxOgm1pamDqvZLLkQPHNPiewwR9TG6x4nZMLN7GQLe6naP3Nx9PXJDEPIm6Y3YvUMX80Ss1CrCPhsqdXB8nB5BMjPxQt0huZXwPd75gp1aePYyjiNtItfbZx3uc9Oq7FCLLLkH9OkfMEuAjwDDkYxvfijPoBM8UNF8xbV9xzaWZ765k37OPNVAseDQXkYbbIEoFPw1PsvZYw3qRIwYm7ixI+gBqXUSxwMfmp2+4ZakMYrf08KjyfXWF6NvKBZCEcr0m1CcHVvSfiK+cgz5EdWRDdvvn838FVqmXRRw== 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:12 +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:12 +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 05/10] ip6mr: Lock RCU before ip6mr_get_table() call in ip6mr_new_table() Date: Mon, 14 Oct 2024 17:05:51 +0200 Message-ID: <20241014151247.1902637-6-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: 3270b463-6167-4a91-f1e0-08dcec62b82d 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?ISCGpbM7nxUA4wYTWWmkNMw2M1mAnIpNCu5a5SaMp/UewarHquQT2YPEgUOr?= =?us-ascii?Q?+7Wdu7OvTZKtfgYcmD1fr5KswwfVcpkZEK4wicgryU1UnEDDawDF63E8Z10+?= =?us-ascii?Q?XpzUyGuXrl02NypgBtf1GJUM0nIfyggKmJVuN1JN/qbEGwCzmvId+xJs/nY8?= =?us-ascii?Q?/A+mwnB6XsnuQ5GxE7zNS+gWwQ4lTHGPx+2urlMIH7QVdk6z+sQiRxkafMj2?= =?us-ascii?Q?MCPr5bK2a/J1L/dwCJ2ncCXkBxDkLfsgV8FwqG6+dbby1Mm6zgSVLMC646Qn?= =?us-ascii?Q?BmIsrhHfbA9g/T1sBB1/MT3fr6js+9uLaNIpMy1oGa/eZ2o8LyfZQMzOCPiC?= =?us-ascii?Q?A0IGImuAwgaahyqchAI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-ascii?Q?Tv2yH3YnJ8q4DYK/E55lmxOREfrne8nQHn5xjpGM64DqEOYs59TCAiESjUnb?= =?us-ascii?Q?xg9ZYV68rWIw6fCaBrAEuLvbcr8dSwopCEqJiMnf9l6JWA=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?/WsHPAjvtQOT+g8Lf7fPQBsCXDLm0zRFOx1lQdRkXvgEhZGV0eCT/3/yRQpk?= =?us-ascii?Q?CSpxIIeKat1HWU0xEMx/WhnWucMDUSjgJbU4e/zmqafSX+4C6A4ATK9NA6EE?= =?us-ascii?Q?u85tt0h2K9LnfxMQQeo8yruK8z3NWbNXZ7bvEZdMLiV3ywaKD141KP0KBUR6?= =?us-ascii?Q?ZI+2uZJkOAA2OgOldqufyVu6GZrVRMIVQDyVM8yd9TLl5M1W5lok5TbBoe6t?= =?us-ascii?Q?CNMBThO+bMpyamHA1/yt/bRw2l7P07FUbsgiXsrVVG+b/L05SpVDFQ2+CexF?= =?us-ascii?Q?P3Sv0SiYNgIn0YJUgH4cOzqrFXv/1lDEDEYd3RnFCD3awwz4nOReMSx+vxbB?= =?us-ascii?Q?wRBq3oWDMZWiIDhzSRJiE4+uXq25DR/NI60FLUCJkNvrbcR52OWbNC1o//8e?= =?us-ascii?Q?4OMsMMbh9h6MWQKuHw9dmRCAbZam83dPFP5MdyRykgSL34dBunXONLhUaWhL?= =?us-ascii?Q?5V8nrUptBeS8xlpg5w4RMWMuXR4uD5ZaVo1jOomiDFkUOwDBkg/mZUTOk2tZ?= =?us-ascii?Q?gVG4fbSS1KJxLRjOcvtXfqgTF4rExx6pzDsY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ncjb7K3Yfm14zkt6zb62PijNpNB0AiyEsXCbDNpx2ey4NKIhKD?= =?us-ascii?Q?4tWPxhQa5S00/19hnomUzTwg4lAbP1bGK/ubQYgE2HfvatG24ijoNXqxlXwB?= =?us-ascii?Q?z4yKENkAQK5kzORH1KuZIqQ/VUcknB7GoLwNJH9MqTc26NAfRb23CSjU5Rrf?= =?us-ascii?Q?8A=3D=3D?= X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3270b463-6167-4a91-f1e0-08dcec62b82d 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:12.1567 (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: vg5ZIpKuWPTkkE6fewrDkT0bBgKfeL50uAvraE8CeGPlnO2UTrHEUXLSP11TLPmRxfTxeXjePl4iGU+bplDptYUDm84ZpD+Rj9QE3y/mRSU= 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. Detected by Lockdep-RCU: [ 10.247131] WARNING: suspicious RCU usage [ 10.247133] 6.1.103-49518b10de-nokia_sm_x86 #1 Not tainted [ 10.247135] ----------------------------- [ 10.247137] /net/ipv6/ip6mr.c:131 RCU-list traversed in non-reader sec= tion!! [ 10.247140] other info that might help us debug this: [ 10.247142] rcu_scheduler_active =3D 2, debug_locks =3D 1 [ 10.247144] 1 lock held by swapper/0/1: [ 10.247147] #0: ffffffff82b374d0 (pernet_ops_rwsem){+.+.}-{3:3}, at: = register_pernet_subsys+0x15/0x40 [ 10.247164] stack backtrace: [ 10.247166] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.1.103-49518b10= de-nokia_sm_x86 #1 [ 10.247170] Hardware name: Nokia Asil/Default string, BIOS 0ACNA114 07= /18/2024 [ 10.247175] Call Trace: [ 10.247178] [ 10.247181] dump_stack_lvl+0xb7/0xe9 [ 10.247189] lockdep_rcu_suspicious.cold+0x2d/0x64 [ 10.247198] ip6mr_get_table+0x8a/0x90 [ 10.247203] ip6mr_net_init+0x7c/0x200 [ 10.247209] ops_init+0x37/0x1f0 [ 10.247215] register_pernet_operations+0x129/0x230 [ 10.247221] ? af_unix_init+0xca/0xca [ 10.247227] register_pernet_subsys+0x24/0x40 [ 10.247231] ip6_mr_init+0x42/0xf2 [ 10.247235] inet6_init+0x133/0x3b9 [ 10.247238] do_one_initcall+0x74/0x290 [ 10.247247] kernel_init_freeable+0x251/0x294 [ 10.247253] ? rest_init+0x174/0x174 [ 10.247257] kernel_init+0x16/0x12c [ 10.247260] ret_from_fork+0x1f/0x30 [ 10.247271] Signed-off-by: Stefan Wiehler Fixes: d1db275dd3f6 ("ipv6: ip6mr: support multiple tables") --- net/ipv6/ip6mr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index c47564f0c868..5171d64e046b 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -382,7 +382,9 @@ static struct mr_table *ip6mr_new_table(struct net *net= , u32 id) { struct mr_table *mrt; =20 + rcu_read_lock(); mrt =3D ip6mr_get_table(net, id); + rcu_read_unlock(); if (mrt) return mrt; =20 --=20 2.42.0 From nobody Wed Nov 27 02:19:23 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 5CA8D1B85E1; Mon, 14 Oct 2024 15:13:20 +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=1728918802; cv=fail; b=rp99c34cp5o52AzGA+r2ZeXnPbEw+EexUYyduuTNYSe/R4GjoCUOD0/3ckeK56gEC5NBeEzEbNDRmu8tVjz8rB/0D+f43eBofxFuQv0mumPwQyAl4eOPvy358kUVJbU8zIsyunU3lb6u268w+bL7drDqKZn2CNDKJ6rQX395VNg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728918802; c=relaxed/simple; bh=bA3mYruUYHF1cPcJztzem+zh0xnfb/LwqJXi2R6yrrA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=JKGNlz5MqaahyQC8b/c0TJv18JpFwKlMCui/JMCNpecw968sXbKrPKsByNO7MkKGZwisqDqnM7z+xwg3HBlw3w6drVOod9qz9Gm6Hb1GHtko3s5F7HR2qlg6TIeWV0GQQsghv0kLOSJuhGp8KtWt6o02BksdpJwA1rFYdfYHZ6c= 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=gx7PNFFW; 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="gx7PNFFW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jDZkIRJ9/4DvgrHIoR8aCdtDONni/sVxyU+EPDlsfNs1CgREjUgkUJTYOE4b/XXi40sIuITDMTgMtoqO5Oc6QnIvLQ17x6FpNMikVJNVZsSG0k9RoD/oVxAOMgRInNys4gENUc2tndZQF5WK8mhZzlTKhTHMND/4VfWFoNzKCi60Mw+e9biDc6GjTXflb+G54FtdriQ2Qnp12hoyM2nC7Tva/vPtZ4H8hV89SDoEuLUCp+53iVRQ3q38sR/jGFzLD/rJeVy1Qa4TJi76YBiW0BiD1AK1bQRzFrP7q3sji/eJrvuShJZTmAQ/RmOjCmPk/aB4v2llZDr7R17Ec1+bbA== 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=waUinzHAEBpb0n34fV4DhvrgjqrSi74LhDrjAFG/EhM=; b=bWwwvx5rk+tw7FTMNoTsWorMdVdP2tAli+YKz9VE7/z8mgV+iD7n/4ijHC3RN3qzTllb0VQC2mogyUNnXjJJS1/ODCr40aJ7guTuPRTVNcsdqyXjRCA16/0XDroAwxaFOLGVoZUDhb1V4Y93yVeTuKWeBxGE1iml38nt9B0t/OGJnDO98J9wzYwoVG23qyUy9RL+HWcNxmwEUkCxPWdU4BDI3jciwCA8qqqJvGbwQL8QeWAu0jG6EKbHdf/OtDsEqindsdyfOXumnRk7XaS139yP4P1fONPH+yUuS5Ep0aFDx8LNmBmZw1Vk0mJyJA/bdtYW9bnfkpu0hKq/J5OGaw== 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=waUinzHAEBpb0n34fV4DhvrgjqrSi74LhDrjAFG/EhM=; b=gx7PNFFWJ8fi4GTeHOEnJqlDv6+G/WQW7WVT6iBw2NQSWJDxwxDsr+Hbik4ToEea3F+NAVrQ22z5l1UZsiMAFPoY7EXFg29rZ4/QeMGaxrsbIZXCynJ59EeuTF57M9g96SmvNgS1uP7kHjhKKqh4GckH5o7cIxcgQUbjktiEDAxLMX0WmyLzOQNUB5NRWmaWZkhDUOVdlHN0IKUWxjJRSAQOTrab/sU4k76LVBA/JvE1YXbH2n6BifuaKSII+s9553UTdXSbuUDOsgOFRkPZWMzQnofK8C+fZFbHRgVI+694J7vyFXvsytShMkg4dvJQsV/9kYSv3KFFimuJDCpu6w== 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 06/10] ip6mr: Lock RCU before ip6mr_get_table() call in ip6mr_mfc_seq_start() Date: Mon, 14 Oct 2024 17:05:52 +0200 Message-ID: <20241014151247.1902637-7-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: 22187977-bed9-4d26-9449-08dcec62b8aa 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?AcBkGMBUK7hETshF382bvQa1k7/Hnx4G+ylD4UGCWEcJE5UTKphp1YJNzFU9?= =?us-ascii?Q?sJ9d2EFY61WjnbsTpGAKSmkF3STrxluoVS9zWAE8wJ4RnqJPKTIOBGdjgA7T?= =?us-ascii?Q?GLXd7jQSaPMa9ekurdnFvIPUGPy8+rM95+2bLqdIk/Bk8RowPvy0k/qKCjb6?= =?us-ascii?Q?8Z+IuygkJQgaSyouYI3Vfl97EcKfvdDbi/+1wwq1kj3YN2g2BUV/o3CARPcf?= =?us-ascii?Q?6JlfaABpF/D5J2ZMD/0/QMFrxoZ3X2qwZCE0sAayWrweJya3Fzfx6kVfALnE?= =?us-ascii?Q?IHd/0yv6Lrkesyk88kILSwsBAIUXdH2sWFM0XSmK+AL9u1a9O41sLbbWPkGx?= =?us-ascii?Q?4lr5C41pcxkZamo83IpUc/gN3rS1KJDc3GF+TOhIF1z5AkwQynNDku53kEZk?= =?us-ascii?Q?CoxiWj9+gDcc2iksSnmF5Qpam6kjbmi5CSCk0LxoxtuM3meta+gt2es8Da1C?= =?us-ascii?Q?ajXhNpZFO10XhEjaPRLB3NL0KKxDV8bq5pDmTapXXon3DGi83n4hOokDSyrf?= =?us-ascii?Q?zEBkax8l5cfDES1wWCo2ww3ZLZFTLIHq4elnPhbKyKfsb6F0lhi3oLJXbJk0?= =?us-ascii?Q?LXO40gzyNOq1L0hT/JVSvJtEgo82A6JeRK+fMVEDsgSACEKpYkc13lr8BAzC?= =?us-ascii?Q?bE+0udENQmTyQmn6HDwseQG7nHnnwp7JmAcdRwJgBqw9TMtY7i8lTex3klM0?= =?us-ascii?Q?/4Zc8jjP7S9yoTc3Pc2USrtX6VYlgEVTr7H7YFgi70vRKwJwMMxHNY+PcSfp?= =?us-ascii?Q?lWz8/VjzaU75xStcZKlSZ0E+6c5weChF9Wy8SJiOfKyRIP5/hsRus6MKK9K/?= =?us-ascii?Q?ieg0ta4koXa+zXRRIR+oCRmEId+JSSXG/kSzCwOwXbnoX/FKX+zRXQjIJ9rS?= =?us-ascii?Q?ziBS5mQ/RaIuGTuz7mdncBfy0aZUCkWRCE8zUceWI/J5dzcK3F4aV3AvU0x6?= =?us-ascii?Q?tZUtN0kRhwZJfqJJClwci039HNI5x4hOdA26qRwwWhHDDWUSuWqgEfJrKmXk?= =?us-ascii?Q?ODolji0+uaugdw0F8dIItLJJ634OwiaGF85CezQw13gID7f2sHQiVcZacHRk?= =?us-ascii?Q?7/Lpv7FiUFIPe6f+i5PPvCMKPkrEQXiHVtinx91Cp5Rh/v2SuBA4hDTC2SlC?= =?us-ascii?Q?IvRBvnhYz/O4cFD6X2OfGK606tGnOU/JkrPeLKFcvIfhRXXMiIoze7rwl1NT?= =?us-ascii?Q?tHQ7b3VbGEa9CBn/NUD5otWtv4DMlOEYKvXBjgzuH/DSzSsKDEK9uzRR40jK?= =?us-ascii?Q?iltxvOkSrxcCTmjFQVTnh6MRWPJGeXDiASMZCfh3JmVWsF6Ueps+04IUi2gE?= =?us-ascii?Q?I9G732FfmHu7xFz1Pn56FAW+h/fOAikZBGciV12sJBAFTA=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?crxF538O18+DBFY99yF3dGaElpZ1C4LNHkd+5KZLWZBManaoOZ8xXkVCsqC+?= =?us-ascii?Q?tTZmWM4C47QZ2Q3Vd56PxducMLbYchOlrpd9O6zkLy9ai23oQ+11hHUK8I1M?= =?us-ascii?Q?zMMbsqKXDrroFI+oRbQ2cXWVPhwTyw59hKDEVqOMhzjU5zKn6+rsF1fgYkzx?= =?us-ascii?Q?Pgzw6yN+eORfqu13fwuIM+oXWzG2ERzFcUmkfoupkm2717m+wQxaY3qt24Om?= =?us-ascii?Q?kn3QVrOhh1PjGTY4EmSTvqvfORjwANJxSzpZToHNlxcGIm7/Z6IHteRdFusC?= =?us-ascii?Q?3ScaKkbTuEUo7XhO/xoc7YM3hk/7TOYHhwf3UtiA4dgbljRy6Dvsry4m8Xqj?= =?us-ascii?Q?iPj0Ir3x04UrPGBKDTd0zAHk6JtX79LVff+Vy61JVcsJclCkg+c+eKvzsdo+?= =?us-ascii?Q?zUZaUKaLbPNMHZJcfIUMvx+wSzD3JzvPo6KHkHvyF7VRks5gCLv++UAuNye+?= =?us-ascii?Q?9aXCaHnn1MWDaWkQhPMCa9knt/+nWCE+6vLcjUPlbaXuzL44TalBK9U0AWfs?= =?us-ascii?Q?vRhepfWxh9lerbh7UBL3WCFcSOp82gOAKVDk/xfPeUzrSXBUox37VOZcOmdY?= =?us-ascii?Q?UbhA7ldhUnbojb2XkpYqFBAXFtLen42gjPninDR7PNAABgtDX0dHljljWipC?= =?us-ascii?Q?qElZ2anCVzjmzNBpySE2oAR7caxQnOD62bSORmLYT9NkYvtp943Um7BTqHlB?= =?us-ascii?Q?8X5qx97aUbIWuMJEEVEVywjMBQwVEv+LW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ig=3D=3D?= X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 22187977-bed9-4d26-9449-08dcec62b8aa 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:12.9839 (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: DFS6zMm+6rSVW4kKhwYDm3pSNJXDlp9W71IwJwnrf8SfpX4DJqNKG/Sh+R03pP9BWEp+PlUvdw3u+STTabBqs5/1zNYC/otmwNSksEZRSoM= 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 5171d64e046b..ecb9e86fe45a 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -467,7 +467,9 @@ static void *ipmr_mfc_seq_start(struct seq_file *seq, l= off_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); + rcu_read_unlock(); if (!mrt) return ERR_PTR(-ENOENT); =20 --=20 2.42.0 From nobody Wed Nov 27 02:19:23 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+ZJsx53EnTJNCffweAA5GrdoA5bWhOC1XnEdSAWrt3rWBTFQQhDFBs?= =?us-ascii?Q?8qXLK42G/gpzswOZ0QaMqjKj9wU94rbVpyRvzJKpYfESrpWQaHio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3XTVERs2gdg=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/gI5IdP5OirxUk9twdOJicoWKjma7QhQMKa6E71RngEGQ07+bRsZG90ooG?= =?us-ascii?Q?eOTfrN1i7JYhmH2oxuzkx796nvCnWHPFWNp4l1wlLtuHiqNbsu+a2VMcd602?= =?us-ascii?Q?yFeHsvSkCf64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l+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 From nobody Wed Nov 27 02:19:23 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 500971C2335; Mon, 14 Oct 2024 15:13:22 +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=1728918804; cv=fail; b=n2rD8+IfkSfPS+bJ8F61sbDtat75j6HxvjJIe8yR70+WWYj6n62n9muHvV62acg8lny89YTm5euc/2EjNUihMjlHIyuqeUwRUgGN+1Fv2Pu/kUBWbQZE6SKSI/sZgQTIku84So+NtGdwnGeI4guG1tat077disyuoKoinrVPsqw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728918804; c=relaxed/simple; bh=IvbnZYuAbIJmfRjKsGI9i/M5B4xWewtEeTJCldFB2J0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=uc0G149GWjJBTmsTto2B7lXyAfMbisBYIb93/rWkZiX8UO9RmcJ5hfc3emQZQcVUeWpKr0mUfGx3xgwSROPFQZqg4O3iDH6bChy357ZUhnbjtPwmvYL1FQl9TqgArzDUidEEBuNDeCgKH3JYDp2HHOhYvpiwuU65FH+pxh2875g= 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=k5bl4O6n; 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="k5bl4O6n" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GzLuowu8ANfYXFEPxEuiK0+NG1n2MP8Otv2VhOjk15ZgJvPkpE+9mLnYBqchWmMk2PWvgnfXJmUgJslr3P5r94fdFUaJYJWZJgqPVjThHR+hmANG63WzuxTqZcs7wJNqrk62k8KQgmS2rjgdTYT9YOC7fmSWklcx/hOfmc6loC2q7c2/2FIoxvDFeQ2lWZLbZqwH6j2CLFDdGlLOvSgySVIcBXUmDHFDH/9Da5rNC7SBdz4ZVr92tkHZgBJ4RYCmhNvRaoUiCoMd+ERrZVk6BvSsU5o5zM111TINeAOcgQCsUZPxlwr7ifR8GQuphzCoS75PqEzH9MbGSY9k4Q1L3g== 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=q/AABujRAVW/xTdIs+1sSIkUsS4ZGj00n5APkd0C1Kc=; b=y+VyMzZnbs5COlzAxlT4iHU7T8t4C4KkigRGadkjZdRjzq3InWOMlDUU6af8nCT5fmSTyfqYTDNhhEDCyYIYSJ8ChlZrsXIS6mTtIQuqSkMI9omdrNfiH+yyZfi+904OjYdmkry90oMhep7tjgCkhkHXXegEYXb1VmYLsdzKucKaOGwakJwJqynULgIXR0ZeUVEI28gnZ+8zA7MCRyrv2Tdk1DAELrhLcBTy+LyR+vGvKNf2L0QcbTW0fTDMB3DQQsl6o3ID2vpyslah40FXw9gitOjUiO+HZc5lDZPpXK2Sxo6k4BuAl79JQfl4hoYQrylHxxkbu2/+4LPjwrpHxQ== 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=q/AABujRAVW/xTdIs+1sSIkUsS4ZGj00n5APkd0C1Kc=; b=k5bl4O6nQKp0Li/U52QNTBxnSqi8EDp5hzkqnDNhgsYpdZ+kXdNxJ3AH34MVklkoedNYC9a4IbWjdbxkecOnBDScFQAArXJGzlVPuqTI4sFmt5i6Nd/p5a6SSUQFdo5RtIHUhxBL15JovsXwK/j+/yqGA/WoOqCc3DA+iXuLVSW4Ybf7lnc1WI6GQWrFxG5/y3Q25RIXMu4yA0r2OSHLoAxcLmk58uHLZ8D6dZ6yR1qe+ZE5tvQBp8iiZ4Q67vJN7xdSNkylgF+FJaWuhi7NVSW731vIPu6HeYsUjp9AM0QUpIt2OF4msC+8s32UoUlPK6VWWVwwNNtx2aGKbtOssQ== 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:14 +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:14 +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 08/10] ip6mr: Lock RCU before ip6mr_get_table() call in ip6_mroute_getsockopt() Date: Mon, 14 Oct 2024 17:05:54 +0200 Message-ID: <20241014151247.1902637-9-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: 187f0187-9bab-404a-1622-08dcec62b9a0 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?ySFriV4mNcBUjUUpT76OplMON4VUBluHtLnYpuW3PZl8ATRXRNbjmobQmBMn?= =?us-ascii?Q?OzkRGc3DArQq4XUoou0mrKi9pvZNu2cmjDmmSlu+hfJUBgp/+vFB38fN5wWO?= =?us-ascii?Q?Y6tyAQRp0jPTrz5k31Yrj9VkATT9dUch+mYpEh/EFIBueHiyFJFRXDSG2zT8?= =?us-ascii?Q?nzgi/wwbTjhoGhxn62ZhOUT0FK0IiwDbEbz1m3wty6pHfDl9NiWMCDR/vUaa?= =?us-ascii?Q?a3jXoKxNL+6U7OluueLvKfCvQQB11C3yMa0W7V11TP1G69itkd8mIeL0/vb6?= =?us-ascii?Q?m/D7FY85pfilMNcYKdXWUTCa19vak9nch7XjUcSNyYB2NmCmJ1f1HR6RBG62?= =?us-ascii?Q?gtEhb43jhCg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tL0?= =?us-ascii?Q?I6u2YP7it/tIwwwAsBarI+jvinI3Bp2ELyQlktEMeAz8qBq9+vN56RGkscYV?= =?us-ascii?Q?RMzcUZrPFdtmHZFMsw1MNInIiTuOJ4UHUB5GRgkVsnajYw=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?dNoUk/A7jRYY8HssvO0y16C5owZUWti1kEfXbMv+LgiQ0XGIAc9CVAjvG5w2?= =?us-ascii?Q?fmHv8MFvdteHW9eVh3NrRcxSGvg/M4SOwh+GxDykymcdbwVtk/LPORG91sUE?= =?us-ascii?Q?VGImsbCdiRVQ8AIQSQltAOtpANDDWKkdZseYAbjtQ8PO7J2/SMJbYiFScG+B?= =?us-ascii?Q?VPVIhrSOKz94YB8yBRKY6E4b/QXi6onZp4BbpTgOvVErJkyt3sntdr/Q303n?= =?us-ascii?Q?yTEDRJzGmpofMcS25Ma8+I79XUWmuCyA58VnX/Bl9Ur6BWL39/RhEwxotW8w?= =?us-ascii?Q?MgMLsyj3OE15fEhk11OAYnb6SR70LUHzt0SGqedJYbxbgqlYUyA4SWMpmbdn?= =?us-ascii?Q?hiyAH0GjKvgJCcbJ0vCsPT8and9PbC8qLF64YqGDa+EDN738Ys0Fmuhi/GbK?= =?us-ascii?Q?oEe+H5oWue7qn2FskP4smJGvnPkWIzOm3UcnDCKFzuaeQGkubaqFeNoWTCtz?= =?us-ascii?Q?cm/0J3qd2fp/3wvgt7k4RFTIb+vSXYg0OMNyD3ZFoL/tn9n4DwIA1LFoJ9I+?= =?us-ascii?Q?tl9W8jzO7VC4/ydyLv6PRCnzIKP56SNOK2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jZ8fMvcofffc4EMyx4wvyOHxmHSfalTKZZWQnWEK7b+NJ0+?= =?us-ascii?Q?XyVocoh3gf0tGhH0QJoiXGkEtfUnjIbNT6+152mP6f7zOxErJAdSExw+9seq?= =?us-ascii?Q?Dhzyh+S34J3Obs4zN/eM1t7WGvuVQYR9u0lWUOznf/gyr9xn8sMwUXlOtbsx?= =?us-ascii?Q?lg=3D=3D?= X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 187f0187-9bab-404a-1622-08dcec62b9a0 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:14.5840 (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: cHLEevHPCFohHz50W4twuuQhw7n+vZLF9eXpk1TuJ1z3NUEUJOa6+oKbh7UpGyDhe0y/FQB8Sq2LR+reFK8dB7PiGxzdBPOm+NIzgru4jXc= 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 b54353bee2f8..af921e9731ec 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -1845,7 +1845,9 @@ int ip6_mroute_getsockopt(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 From nobody Wed Nov 27 02:19:23 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 A9A2E1C302E; Mon, 14 Oct 2024 15:13:22 +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=1728918804; cv=fail; b=gC8Y6F8BMr06zTGQ/rwOT9qea+P9Epq5QlmLO8xsWsh7ezC/I+mb79x4gafA75tKtIA+k2HcAiSIIzbwBttBrCPIz0fB4Eco3yFFlPKrNMikwW13nV71AEJfkSp5YPg46KBQYMSndSomjvID14Snux0BkoaQNBohSk5S1S4c9ZI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728918804; c=relaxed/simple; bh=v9mYVK23KMrFTQ0SBulN6xa2/1MW4F8z+gjj3zmk10o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=trNGeEOBKaFS3tOIeYfMnvpxag1++1IC8LydggmKhS27di0U4XMKTlAf2UA3IA42qnqnXruwkiB/7BdgihTxd4qv8jtTatcVTJ8pypCxpZBppuIxM+qx5Yv9tVeZWw1sgOrHaWGO/RxHCXMBopAxO9omCdwG883u85rTSp+7+G0= 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=d+utkF6b; 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="d+utkF6b" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kc2OWgWU8yKS31MV+3hu/w5YefAgQuwCHyhrX38XQkUtX4hO4CrmevSqrD/FeO1+Q6qg+qTqfUzOSYntJtx5SYgpwFJ0e5m3jZf1LlRJlPZM8VOHcnglfofh083CuucFnevQs5agvK9yCKbXa3i4x1hv2eXe7w27Q8h6u+mPjEEhUNO7K2E+MMyz+Q8uj1eDc9E0W0HFVr2U3BgHaCL2GZzbqlx23lyaQPslvLkY5FOnAoEZt6agVyeMCI7t2+XrIo2jpNAp08I5imSVvmQ/d/ORAG1EOZVL0rBnAiW01i7LqBHFI5YP4JGHkxoqwQNpqSQISIenBZiWKZ+Gkb0NRg== 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=OkA1Pnin4WrNswcShBwME0jInUjGTAbG5vZOR/OAaGE=; b=suGPc0HlsV2Fedr+fkf0FcUc9lMfIYWdAbugQlAL9ThcEwBLTOfc9ykvuwIRSpKzssmgL+rDmd6iefFjnWZDUuUcD6SRXtDkgVLE8mFeWxIge/kr0hCd//hvYC6fjY2RKsU86Uay3GJFFQE1IMFWRNOHyTj3va6neL8iS0BP7B+w4FvpoPfoN6WjdaNmujaXWmic/XPQgj3Gj6PusEwrpwRgKXsmTL65A23ADXMMi8zTlO1510IKxF/PZ5/U1RNEtBlz2lNvca2WDUd/twhGmZH3qLFLKtd157wsX71L77EzXv1PLl/juxri3v6mdO7AqJ+D180MWETpCgfAcpdwfg== 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=OkA1Pnin4WrNswcShBwME0jInUjGTAbG5vZOR/OAaGE=; b=d+utkF6bYysfdqxjHKnp8CH5RvuQs1qZsTQvND8RcbM5TUj8HsOc9kkUk39hbd6tNWi/pyizpatmleI71+M9cCoLyQ8Vg3637ve11JFdJaEn0eCn8IzvSNw4Ko9XjGuybcI4PD7VkT0BCKEfoLXOd7X+y4W81qppZUiwY4w9Euxi6r5KkZJbe9ePzTluej+lmRHYIZf/TUbeWEvTm+OIObQVjiMDLStrCT4NlHtXOxkWpyT9IY/ov1V/zuL5o/1RdhWTxwiUJeMP0rXKZyovE7KbkT9sgmpbU4832E5o5OujYEYDtWamk2X+G5lYAHaJIkrcgpbnxWAb0kbXCyMXhg== 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:15 +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:15 +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 09/10] ip6mr: Lock RCU before ip6mr_get_table() call in ip6mr_rtm_getroute() Date: Mon, 14 Oct 2024 17:05:55 +0200 Message-ID: <20241014151247.1902637-10-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: 444b7f27-1458-4c0b-55ec-08dcec62ba1a 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?by3uf5gE23WyZLcSiOyCO7uJfXDcSxBTe7sbIoRt5OycGFicDpg335wFtRw5?= =?us-ascii?Q?cvc1QygWecK9fyQrCyfRLKpPbJRT2bzNjTXFTvMaLVKeiT/+ZxNwDERjmju5?= =?us-ascii?Q?EBfV09JTvL1Ne6sPTzISyDZD8nbu34zLnWDfdGG8lLoN5uteAPMkZxzEw/px?= =?us-ascii?Q?KSr2MxKOSjVt1yW9qHntbV4jWHxBBQHtouLrNX/xOai4Yjt46SEqW7FNI6HK?= =?us-ascii?Q?9Rux/Ocj/2fGt926pcnQYIjvQfskVjWyEFHzlw7bsNp4gqTorQVxNm+EJV3l?= =?us-ascii?Q?Ry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eKsYt?= =?us-ascii?Q?447kiVDIzHERkwUtQG/MdEffBR7l+mesVEm0oSUyoQDkwBrZtFP2LvUEItZ6?= =?us-ascii?Q?Cpa2o6cvCsVn499MvyiJNguEK4SIMK/AfXGHVfraWpqfNTj2plfwe9eIgki6?= =?us-ascii?Q?bCuRBclRmlO+ye7CE8SIYBe2zYA4Bj72qTGqAegtEMPxfg=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?X55ItipCsCGIl3HKOpCC5WOG5V4+I/C1CFlOc6fm118rpMK2rl5agVbD21q4?= =?us-ascii?Q?/3UuGV+tzcYIRCbb53e0Kuwl0aacF86O+1RMnl78L0kZ+a2GFy89AnSco1jm?= =?us-ascii?Q?Pmw7mW9e4bTRIFfiIuuqpt+HLyGzT4I0wr81eegPn1wW5YjUQR2PGpXud+T0?= =?us-ascii?Q?N4nqmrN8L848gUD03Ce9LK3Xgb0v9vvKKo+dZQfQuF0LLV0omf5I8y5xEJwg?= =?us-ascii?Q?TLuTyEeln++H8Y6gRQTbZ0nPCSI8xGrgxDcgM9wmeQwY8iYrWzUiFep8rXUO?= =?us-ascii?Q?CdJTznXXA6QcC+DzRAjItYPTXHJ7rVDWeW0SsPF+SXQmSIdUb7FZxrLQnBy7?= =?us-ascii?Q?HVXlQuUokoETYk1NxkwF4X6ka7EgWPy4Cd00to9fMs8H1J7+4/eEc+SZXtuO?= =?us-ascii?Q?dX6Hrl+EL7H7+q/F1NBgyXmCGTjpPkEYT1l7D3dZyIUWiu01KMnxglwXZLjf?= =?us-ascii?Q?IAOtsvvAx6+4GAHykarhfvxl7AkCV9mgGjW5pV8qU8wIy+6mLKSeUKVb+llp?= =?us-ascii?Q?H4tJjpz+lMYkje/Gm5MhR6gRjaPibYlMqlK4KjsooeGtmXMXmmi5nr9jtz13?= =?us-ascii?Q?vHAV+V1OPQrBHOo5AMye8i3podWHIvvSxQxdeBevw688C8zWsBc0eHv8vWDX?= =?us-ascii?Q?tpqxVe7Yzbl7JccaKhc7mpv3tEh++KuYvjxi12qQco4+5qAbf6FHq345yK+P?= =?us-ascii?Q?Cz38kxy5SrVzOCzmjmRnFy2/7sVWsYKIWMZp+XU7gY0wLJFXruz6sU5AgSXd?= =?us-ascii?Q?luki3iv2iG1JfliQaaNajlbV0Se5eXajTRIj8+OPu7XLZphdkDICfrQCLSjl?= =?us-ascii?Q?MDczoMMZF8W15EPuryqJIt8lfB3gV2HtBi1npoNkhyHftXAQB8ES52taYp9e?= =?us-ascii?Q?tURGDuu3KHrDJd2BTn6Tls6You908+SVkdRzKH08dLsAUMIOVHLyTpFXgGZE?= =?us-ascii?Q?HX/GGykE6HWbKyCbv1odAMCg7bJRlwThfGgnTXaYTeI+tJxgyt3MhIpNpia0?= =?us-ascii?Q?xFzJUf0QDh/PlbjdR7ZA1OGhcQcki8bpZXX+J9hYsC3O6f/f/kndLHHnge7l?= =?us-ascii?Q?8AnPGudVLFbsmbkmY1GALZFS7+QOtPiZl0SYsiqAmBJnvr6UlaM5WsltCtEP?= =?us-ascii?Q?saM/Lsb866Lsfogca7mYGdu3CajogtL05SDPxLTlXYR8zJZwHeZ5w30AHwjY?= =?us-ascii?Q?L53BraSCA+dfPCTxHpbYrZzLc4Vjt7aXojXn2soW1NBPbaKL968u6u15J/wZ?= =?us-ascii?Q?OWH1jKfljiVXmEWOg7lBXK9J0Tk9NzThbanVwSN8wRm13KlSqBLPX+fh8k15?= =?us-ascii?Q?sRLkKrNYvQsFQmGF2FAC3VinOVFbXKYPQ5oUSbrtM6+cJBF2X2EOKQH3R8Qv?= =?us-ascii?Q?zeSHXjxQDhyXtpOZQvhUe8IiWBV/z4VG4xjsfYYBxryFuehFssp8UPOCJDum?= =?us-ascii?Q?tcphNJlOiOK9NzJwYUo1xghpETfL1LJqgv1aSUU6e2i9Q5mkHWduE+axQrGV?= =?us-ascii?Q?yZfYwtYDuQYL4xYDmlYYxronBPVWWyBWil+BQAscexUzIL+PuUW6kcS+idsB?= =?us-ascii?Q?GI2NyYdqmNF5C2dH9Je4cU2wnDmXNnWK6l0WcT1M9Y0FkXue09hXmwxSh5aG?= =?us-ascii?Q?hQ=3D=3D?= X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 444b7f27-1458-4c0b-55ec-08dcec62ba1a 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:15.3900 (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: mJe1yELAMx5wKH10/spBk3/ruifR3gIuirZ5Wi3s7Rdu1ID7kfkd5ipPVY263i2DlO7UfReg9Bmnq8RwNHsjKDOrlkUbT69ZjLI2wj/9gpA= 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index af921e9731ec..01b58156e06a 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -2594,14 +2594,15 @@ static int ip6mr_rtm_getroute(struct sk_buff *in_sk= b, struct nlmsghdr *nlh, grp =3D nla_get_in6_addr(tb[RTA_DST]); tableid =3D tb[RTA_TABLE] ? nla_get_u32(tb[RTA_TABLE]) : 0; =20 + rcu_read_lock(); mrt =3D ip6mr_get_table(net, tableid ?: RT_TABLE_DEFAULT); if (!mrt) { + rcu_read_unlock(); NL_SET_ERR_MSG_MOD(extack, "MR table does not exist"); return -ENOENT; } =20 /* entries are added/deleted only under RTNL */ - rcu_read_lock(); cache =3D ip6mr_cache_find(mrt, &src, &grp); rcu_read_unlock(); if (!cache) { --=20 2.42.0 From nobody Wed Nov 27 02:19:23 2024 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2046.outbound.protection.outlook.com [40.107.20.46]) (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 0F9691B4F2B; Mon, 14 Oct 2024 15:13:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.46 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728918802; cv=fail; b=L+6gqgW7pmSc8eEUWeC9y0vNUtmQbQyk/k1h9gr19ZHANlC+Wee9nshqZIcGLymmgkHgnekA8LBIryLCTP2EEmJyeT02kvvJuPMlUXXdwsS50jONiRbnaLh/EZDpjFWBM1OAn1wDAZ59oruqvvaRNcDjVyRVxj81Zh49E6YiZlc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728918802; c=relaxed/simple; bh=Dh6mB7dPxWk/NdWcY3Fw1HEL7eDKqBF+sgfJyG29Gx8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=ove3dPfEHR9c8F3NsONi87OYVySbVPtHPiU1I6bzCydTxL7YY+kfPWqG96p2G4hwGIvNK/wAAooJ1OHartsgG95EGGc0wOXqi9hC70IChTMdynigqic1MRDd+9qzOZWQVjMq/AZmAV9VaGdBPS/N541uAZaI2DIXcyms24GvfTc= 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=OVQwgOgs; arc=fail smtp.client-ip=40.107.20.46 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="OVQwgOgs" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BYpRBSq8msgJZsrGFwBpTp7kEPwZAmEziMTz6YIQ6ch+lq7z/c+Ov7deJFvMheGlnNjLbEZTnFQVUF2JYNHfaOEmBkxz97K9/KW5lCLu0IUr21WhLfcrxLLZiuW3avJcM8yl3ZkoAIzZENocsGzB1AoUB7HpE7rpvTvIES2Y0WXrPBcGvO25+A4l3KjB5Lx96Gglsd4VdXpUt/nUSnov7bTYR4NYL3GrQwOnS0rqxynBCzDyUwKUfjXZ4VaHQm65kfz7a1cQCUl8U2JrpYw2kP6w+VfqlT72Fb2NQ/e558QMDOaFWxxHz9Clb2RwnMwZIFSctrkBALfTeoKWLDAlhg== 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=MJ/RYkwPtUg6ac8ofSc9ayOWp5PzT3N/N72IbCKbTcc=; b=CfJh4fRTLMuD0EhsrC1GuUvrAV3JHNZIsz3YuERG9spq/2FeHEp8drBG97aAP2cB4D5W6u86ODBK134IU3JLH5/lBS+ncx+y6PBx7s8Z8MmeT5I6puxISqPwecMeJUOJcNVOL6oH+agnWto5BoPW1+syVl+tOl/Sww+sJo/zGnNjpXCNiCr3I7g7nI07XzlJlco+g1k9RBgnJqYO2cC8YYTGGshcpW9JlV1JPdoIyVjr4WOFUw3ZT6i3tLjwR0aL+h+pjnWkuPC97gnPmAQpG8ob62ysKZNM6j364mKZT1jcf7rsprzkDkRLm3jDgqlB3NaZvew51hd/19DKlL1GXg== 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=MJ/RYkwPtUg6ac8ofSc9ayOWp5PzT3N/N72IbCKbTcc=; b=OVQwgOgs7AgtQD7WATbBAEYHquF8if6xXNkaHBQ2z2D8qjLiQflwYpQQ6aB5fqtE8Ppt0CjYQhpT7uehqeJYBz2DpZSoMTLBTXLQlMGlaK8k2AcmfBFf4yaK8dFI1Qdbo+zQneYS3l+vII9nWz2aE8GSIiCCZ0XOa0pak818Nek/NQtccJGN9uKxG37jLADpT/nNC0SEPjSLVl9hD/EuOlBJM9AeobB2mGWSn3Ee9lrMARJX9oQeLnU0/UpioaxcViQNcGi1rXWthsYvDTpQxIg5WHofuDZIAlSJsu2Ih9kv7HbmTSPkz5D6bu5k6UbJ9uTgJQw6ihtSDtPicYBHCA== 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 DB9PR07MB7964.eurprd07.prod.outlook.com (2603:10a6:10:2a0::18) 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:16 +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:16 +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 10/10] Revert "ipv6: Fix suspicious RCU usage warning in ip6mr" Date: Mon, 14 Oct 2024 17:05:56 +0200 Message-ID: <20241014151247.1902637-11-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_|DB9PR07MB7964:EE_ X-MS-Office365-Filtering-Correlation-Id: 467542dd-23a3-4c3e-f283-08dcec62baab X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?EBH90/tQ05HOoU5JtzSUGgayFI57lK2KI71voFmGVwiLEG26IwkDfnPGdmUz?= =?us-ascii?Q?cn2LMWpC0pBVV7ZR31bCTK6Q8NRPlYcXKtiPyaRg2irQNmxgW6ik2jPXX2L7?= =?us-asc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vNtfjCiU8IDyx?= =?us-ascii?Q?AWAD0v3lGJE/Zxn5WAgYbZFOBqc4BXgqdqmlwNxPDwrkVaVBGJYM4NU9fwca?= =?us-ascii?Q?xPxbukDTclrZp2PGwQpjzttH7Drbe8UMEGMBm/jXS2Z/Ds7ia46JInH8wRYn?= =?us-ascii?Q?Lj9k0QCJCs60pP+WGUUVp5uwHdHo4JoxYa4Td3UMt1ByjnDGU3wHMTOAonBg?= =?us-ascii?Q?BL6MgHvrqS1zFilSgegtL00w1a7zaB4ZPSMbyCMxCK5B8ByjuwUIjaubDUym?= =?us-ascii?Q?fFhu93TzKTqOqvuBVtYgCQkHKzStSdL05ygPzMUUJVxmKDRFddA1hbSVvO45?= =?us-ascii?Q?7d39Z5agHELyOoP1+9RiEYBtRvwT1lFA98quJC/9fzwZUA=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)(376014)(52116014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?txRKHygqz4AyTTeH8bF+p2qtfNT2vmB3kvpZ1fui0KFrD5buFW8WuNbzHpY5?= =?us-ascii?Q?TJVoTXMqSxJLLLw8I/Dq1EG5RIm37pZdVjUeC6caAqiF6DYvaLgxeVem8tf0?= =?us-ascii?Q?hi+HPiMD2lMH8JI1XAb4a4KyezTXidqK8FCdWEEeKKO2lZtcOkfmahU1KNaZ?= =?us-ascii?Q?Xxv+sXH0fDcAGscDpjBCiq68waGpdI8+ZwHNMa31EOYrx9U93CusU8LX+wJO?= =?us-ascii?Q?5djMACRGKJuSbRygPGnrl4nOCJTIsBq2qsPaTP8oS1j5h8iLXcn1uJozYXO/?= =?us-ascii?Q?4RAEGslhVSsMuGmovLG8wVGN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1deREAQwQQh7LnZd0XGRBtmqRaB99aDmYDenQjWVKEvD5G5tLhqGUE2vH?= =?us-ascii?Q?e3FesrW6eP9xk6zswHQd75WiEdLeE3tKw5iqiJUKvnjcOoho38xDjz8RWsg7?= =?us-ascii?Q?Uiysid6/2L1rg5989iPxiZ1c2w/Cfrt6joV5DfCV/8P7/dJ9zBXW6H2Q/apD?= =?us-ascii?Q?grimCI4IMZzZhLlMaczAFrAVF8seE8MNsCfSE3GRC1gHLbshyn9U8g/Xq3id?= =?us-ascii?Q?6m81Rn2/Os1Wvkv1EOAuWutecKhBh9m1cJD6COIMZ26Fhv/ltyughMPgzKxF?= =?us-ascii?Q?miwwnHK4tygIKiBkYoBI952qOWQ9ws+0LZ0zrfQ09dLc1odhhpi2lXePr/9p?= =?us-ascii?Q?m5itmAp0b+zC88sQMEH6q53+W7yUI+mzgjO5841iB3UugpXWetU50MoTDXk4?= =?us-ascii?Q?YQ=3D=3D?= X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 467542dd-23a3-4c3e-f283-08dcec62baab 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:16.3631 (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: HM4B3ZWqeKQJZ2SSWgCeCgiw2HqyGFPKjEXpMCE1HrjS/kBZghqFmSro25aSk3ScBTYaWaZDq5iN9rz4oeRhrQ22fR9m+D1q/3jmmqFd5ps= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR07MB7964 Content-Type: text/plain; charset="utf-8" This reverts commit b6dd5acde3f165e364881c36de942c5b252e2a27. We should not suppress Lockdep-RCU splats when calling ip6mr_get_table() without RCU or RTNL lock. Signed-off-by: Stefan Wiehler --- net/ipv6/ip6mr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 01b58156e06a..e52abedafc9e 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -105,8 +105,7 @@ static void ipmr_expire_process(struct timer_list *t); #ifdef CONFIG_IPV6_MROUTE_MULTIPLE_TABLES #define ip6mr_for_each_table(mrt, net) \ list_for_each_entry_rcu(mrt, &net->ipv6.mr6_tables, list, \ - lockdep_rtnl_is_held() || \ - list_empty(&net->ipv6.mr6_tables)) + lockdep_rtnl_is_held()) =20 static struct mr_table *ip6mr_mr_table_iter(struct net *net, struct mr_table *mrt) --=20 2.42.0