From nobody Wed Nov 27 09:54:28 2024 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2066.outbound.protection.outlook.com [40.107.22.66]) (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 515861CF7A0; Fri, 11 Oct 2024 07:49:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728632948; cv=fail; b=Eab6laHcvHAYNlzW7SI2rP3VI9Ml87rUedXYpoanNI+yhcvKQQebePQRIHjluc5zMntH+vso6MRNSYilQTr7gok/RCVzQlYIb0TO3L1wgJfI7MUA/mmgcxqAQZlPoAlTYSUvyLcxrkcWHyvXd9dquWh8PmvClcoiyttl6MflWrY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728632948; c=relaxed/simple; bh=ib6Faai4OQRqmtopYKqjOO0SsweiMc5aOUhyF3/iuI0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=Z0kkuCvpLsPFVaDPKRgm7nPYfAOp/Ndwx1AEa+DuMYBi15BK5sNUg5HP0JzUrZh6tbT2/RnIn3hrigTsw5fLrWi2IB8rbNM3o1Et1mGt1m6t9RCFznDKb8mjAH/q+Na2WGFv6Wm+dzzDv78hq9Uzhenh8Zp9zRbgJrBRET2qk74= 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=KuzAORHp; arc=fail smtp.client-ip=40.107.22.66 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="KuzAORHp" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rijwIOpOqbkAfdJoar1pjTYWV0nx2OFvXg8CqyodByyj8AfEmtqiV3jWHfYiuO5NJSuF4xD6jMRs46eSN1zr5kJlotA1cvo2ZsxqlnAtccHozHKj9I8hScKFY852fnw4Wj4fRJ+0Y1s6sap2Tz8gxAHdXD0Gap2JjLbL9ogPE+2eEqxZ9InvYYev+N+O1mKhUFqFGr75TRQYMQ9nOCV4D+7neRzq895xdGwQd+RPTI3Te3Nkcv9nRJHvJZq2vjgr8KzYnEuJtYxOiUs9GLYCici3oZ8cU7efSuDtf503u/ljj6HVbejIA6XxghdH+zrm/106t87A5Uc2nK2TPnfoIw== 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=BOlw3vIHm0JWG5WKiDBlfVwvgUVFJJpERxN5fJTFhoX+Co64ggC5+8eSzYiqQLQA5g8sxO7cuMQbUY2sBVYTalSXgHoshLEjVJk2SASsv3aNTaGCWJIuTGZ4eYJvZYBcr8mZ4ZZuhRdLotwJWQfhjeHJ2jL/ol117trWGdr5E9AZGpPVQddPZuNxPIdMaNtjV+zdeP/wK1fvfnjU5WIQAcBGTA6azPhAwoi3rBOvjidO5Olma5jgHXIitw7x0CsvvXXZpnvo6kWabjKTtASYzR6/Xptnv6j85aiSBeRXdRGYZM6u9STMqpNf9Od1wMtEeqmYcfaM+FVUlYjhKpnzNg== 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=KuzAORHp2aCXzgt5hgzrH+7lISSymJl02gsQzBrhliK/E0adXAzOwy0UxotnZyiAtJRN0uNO83+CeO5wJgr12b2IHQ7ReRJc0IW0g2EZuCvude/wXedPW8VPd1kjHGqOFvkOASeP0v//TEDDmzQQaT0ARBWtoyKGShZiEYKg3NzsnSW0G/POwA0nDPKnf5mxmWtaRATv6v+nkGTI57Rts1wdT/C0ABEZvOUMVw9zeWySuEFV9BVlndBk+Yo/6yZqShRv+UkuQo2UGRk7Ko6Bi+RMLYbgITYze2RUVA8aldOKCkThzEcEs+n3YfsRuQr+ZTNihDWCp6oZC9b6ATEyBg== 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 PR3PR07MB6922.eurprd07.prod.outlook.com (2603:10a6:102:7e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Fri, 11 Oct 2024 07:49:04 +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.013; Fri, 11 Oct 2024 07:49:04 +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 v4 1/5] ip6mr: Lock RCU before ip6mr_get_table() call in ip6mr_vif_seq_start() Date: Fri, 11 Oct 2024 09:23:24 +0200 Message-ID: <20241011074811.2308043-5-stefan.wiehler@nokia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20241011074811.2308043-3-stefan.wiehler@nokia.com> References: <20241011074811.2308043-3-stefan.wiehler@nokia.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: FR2P281CA0175.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9f::12) 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_|PR3PR07MB6922:EE_ X-MS-Office365-Filtering-Correlation-Id: 0a735730-126f-4893-35c3-08dce9c92d86 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Df5R+ieoCCUdgJC9RkU0jf1aMCOCQlGdM0hUIN4K9AdU5eDlAZ2CebjN03o0?= =?us-ascii?Q?eP5olV9USmwgPdQztb1bLfsFymzwAmMh7ZUwlU4OFTHmcd0hPqtjhMMOgz2j?= =?us-ascii?Q?wCDIo/yQ7qrzHO5K1zyJckAdV5tz6q6NC4CGVnECOF/exAyaoLHBtSNZra8o?= =?us-ascii?Q?cIN+0FEmMQzDnA2fhUQHmLv9dhZi8EfYagysu72M38w9hVFjYw397a2p3QOw?= =?us-ascii?Q?z+XgakVBGnjObR9TjbEezBeV7CG309waW3+v/T/iHCwfYbH5wERADwdOKq5H?= =?us-ascii?Q?7rrdHINKMMzC4MLmCo/qIWiKz9i5gqNrH4ovWCiVrP6vXPu1/QyZyohGMMrN?= =?us-ascii?Q?7shtOuYv858r/leoR6H7l6xdDdoJqeCcUDg1KV+DcILhL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Q9XZnSH4k46bSM5dSPLs7d9LQ+4CYgblDcI?= =?us-ascii?Q?JJLCTe9V10L440rvC0HVHoM550dpDMFTY9+MfA31B1+P2A=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)(366016)(376014)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?RlqlSUzBgntMTI9u6AH3x52M6BN7Xn3KHS97HSt2Ge/eX3zV5c8YppNW9Aso?= =?us-ascii?Q?hhFmvpl0eetQvRVS5vk5Z7f16qNAb1kILB2vhblSD9KOKICdXMtdvQxDnSED?= =?us-ascii?Q?mZ20Pc4w5mU2PxSGXuUWTTYRMixMWBPfG4AkYecY42Q0mkus5YwE+Fhczy+A?= =?us-ascii?Q?Iia4EK9jga9niq+iDq2+KLHoRW9ie9tI8R6HtpeQJtNTOUSeq6t9xc69J7CP?= =?us-ascii?Q?bDB4KL1zOhUIy9s2XnyWZ8g2Galk9nQ6FCaLtj93zVvkhuNBQjVqtwYheLJ9?= =?us-ascii?Q?Zho4qx2U8Xkls8EsgGfAfGsohr2hZVADl5FkQEIhr/FDjZXnbkPFZ9QpCtA6?= =?us-ascii?Q?hpNpRuCnBJLPGeTC9P6m0w7AetEaj1tgGtEv8PxfJlgiDrETUy2V0gFObfEY?= =?us-ascii?Q?VistyupQ3dvdbMwYqMpRmOlcMsdA4KEWa9eEhPJdeeZoTWrZ2onNSos+2zlv?= =?us-ascii?Q?3vGIAba33kpo8FIgmqXj0aSp1VMIqESNBAmgFdoAWcGbjEnlZGy7AZwUkWOh?= =?us-ascii?Q?hf6XDOph72+H8j4IVI9NcL+MBvLRfL9JlZwC2jVODAKBYUrPiugMBSkiTD/j?= =?us-ascii?Q?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8RV663gOk+ircDNe/BN?= =?us-ascii?Q?hCdbZegrxjwR1CPfX52eQkrYqEws7xUYvB+lb5XKemsSn2CFdnblY2Yb/0cG?= =?us-ascii?Q?69bxi/kaSxU/2RJCeePhiPkxamuYDQq9LKqYdRQH1cj+6qOJ1EMGs2YzpPRq?= =?us-ascii?Q?2g=3D=3D?= X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0a735730-126f-4893-35c3-08dce9c92d86 X-MS-Exchange-CrossTenant-AuthSource: PAWPR07MB9688.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2024 07:49:04.2147 (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: Du9jbSr57MN3PjEm1a8T0SdXL4ZgyBR8H235dahKoNlLNa//7v6Sk+zsf0o1Z10N02dD3lgMX2kfofLiswPTDc6oWDQFvB81La3GtGoOjmw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR07MB6922 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 09:54:28 2024 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2066.outbound.protection.outlook.com [40.107.22.66]) (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 3110320A5CE; Fri, 11 Oct 2024 07:49:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728632951; cv=fail; b=kH4nGgA7aYa7Ai5djcWy5cK+VFC1EPPJ9zNVBZFR+Ca8Y6sa9fBPhdhVhBQtBLrzogVzHvMmvdlVNIH0Ckup5MD3TJLU50aPmgKjjdVzVVOkJ72semtor0sJbESwYHHxWaEJJOsTg2RUg0d1zMGi7RJJ/Ib+NW3lF2pzmhmD1SM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728632951; c=relaxed/simple; bh=Ub3FhLOugsTudiJ21QKwCsdpS1c6AbFIk/qf8Sza/5E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=k9mON319qpOQuRK1FTcBdfzUsxPcKxnMfO9TXL8EES44+MeRGeBZGpuCCrc3V5F8UMH6/jM4z+FkDwWqStQT4NTYAXgmJXKI76z+LGSsN8GTvYJgDnxE7Zkk+/5WlcmSbUSVz4YgFuNsPheOlDuMprLn1W4RTAjN8M2ZZqknv5U= 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=A+Zb8GgA; arc=fail smtp.client-ip=40.107.22.66 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="A+Zb8GgA" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cKoCsk/20tF+5SgBX4CvoUFK8HHpun9+3cfDuRU5sWrTdDpDAl7a9SwR6abLqGWlqhWEZVS7cAMyNrDBvg45AMiOkLeMM8QACzzdo8N63DHyaUKJzyXJMp7K3g8wsmmu1Df3Y5bWuVPEFRx2OJxv0scPZaOq6n5gnraREhlWK8iKZ/OQMIww25c8U/97ZRosKcxdhB1vaQpv2t7Dzv/nTF8zETPu8uv3iE5wWsIkGyFpXqIztejXxBx1IIzk5CEeBRWMi3XnR9wbHRnEFy3P10I3TS6dFm2RU4bYzwJmti6o9B9uZygEMaaUYBuw9nDfY1Oi7g9v1bq+sLq95gg2Vg== 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=8YflvkPl4XBLYAWY6+EvgsWBUsmz7bpQmXcECT85pbk=; b=F10MH0ku3zTrAyZJDHu5H8MEqYnXsIHTZ11MGLfv65dpU8Mg054QbFNM3bQJogZHu7smp+hiNulnU0fAq7aoEo1XAZ/IVJn9YZ53u1u8DILtkkBVHnPSWphan8h7AvgyenNxRxIwfpq7hMJ3l3dqHcQ6d6ALoITtzagnFAIWwtwOJzQZugTTfNupl8KEJMfx/wMPNQVj7LNc0btCbytH9yn4bgwuTGRIPuf5SfRX2LUY+kKgDdZVURwjcvswXW19FZ3tqDbjzC8ZRiN5EHvhNsqOVr2zxYO1a5vhvwxvR1MigncIcK190FVObrUXe82kwadByyei99RRCxI/TzvbTw== 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=8YflvkPl4XBLYAWY6+EvgsWBUsmz7bpQmXcECT85pbk=; b=A+Zb8GgAD/rWwpni/nYiRTedIgHJn9LyujlpNnu2YqonviYyO/yKVOa3RSpFCBcid6fpaY+QaQRfwTtJrsZsUOWZ7xvb1NYi+h3V8o/1TolNl4ix9fA8KW3pVx2ypZLpMODiG0ANIQWiSgWtPtqeAAk3TGPXM42pUZsFxysQBuXZvpjf4nnNIH/IQ4A20o2xrVVGfBQ3h7N3nhQybycskyrVUljlT0LoZdK5LeyIeT0+JaWbvRtAz5dIwl2NMmmvjMGJQsw11k5fPaGHEDEl0aMsFllf6uB9qo48Gdx11pmmIF3wnIu6TW0EccOefEQDvN5nJBUo/+fsJDbe8nqgMQ== 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 PR3PR07MB6922.eurprd07.prod.outlook.com (2603:10a6:102:7e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Fri, 11 Oct 2024 07:49:05 +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.013; Fri, 11 Oct 2024 07:49:05 +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 v4 2/5] ip6mr: Lock RCU before ip6mr_get_table() call in ip6mr_ioctl() Date: Fri, 11 Oct 2024 09:23:25 +0200 Message-ID: <20241011074811.2308043-6-stefan.wiehler@nokia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20241011074811.2308043-3-stefan.wiehler@nokia.com> References: <20241011074811.2308043-3-stefan.wiehler@nokia.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: FR2P281CA0175.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9f::12) 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_|PR3PR07MB6922:EE_ X-MS-Office365-Filtering-Correlation-Id: 39622226-0726-4323-59ef-08dce9c92e4e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?2kMuBF3jzETtEU3aSCpFXE/J+/w9geClJ2Yb1wPebOwjyvDz+93sdsdS1EZE?= =?us-ascii?Q?1JlcLSiVGSFoJgXOlM1T8iGiiCpg2ueHRtuYOv5eGaTriDhaFcTxOP+8QONf?= =?us-ascii?Q?9SH8H1qHxsQ49ret90qN9LLLCVCzrO0tTpaPsSOtTKSa2CBTxFflZ+R8tA0V?= =?us-ascii?Q?LUStJISNGy14BUicjyzjRmmW/vp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ascii?Q?3ZoP6gPpc7My9/+/Yl/G9grB/+RzOyEpcuNAmFHjQvsfi+ZWIkhFt823LoFI?= =?us-ascii?Q?38ahUZE+N7EpsYJjTMMgzS51MeNLs3X5m2u3khY19IOaT9rdq4Sh9U8SbTYK?= =?us-ascii?Q?TBnBrpPoCZgSc6LA7FYnCqMFxCCZ/awuy1ojrmEFC97/X+E7JxKODkWsR5on?= =?us-ascii?Q?wllRnuCQcMEEckb2DqQYnLoudkl9zRmPjl+sW1U1kg1+CvyLYDbudeLhV1rD?= =?us-ascii?Q?ACYU3beW40DTVa1DAlYqzN16a8ZjGtPvYRPY4AbLwtMlXA=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)(366016)(376014)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?YmMpSHzv/CQ8bmElVklvAdfjuXTGflXxzrsfNxIhPcOU2Dnk1NVEqapIqQHK?= =?us-ascii?Q?K61BN9TmoxObKu3AEesHQtwVUoZ6+KeREvaGrraqKYXkEtuN72/108Oa8bVZ?= =?us-ascii?Q?Tjl3XddmgJv+vox+4GMrcmtbycOPy31esdoVoyKbe4edWTPKKPMVnkL9zuQp?= =?us-ascii?Q?Ae59M2n2FjbNLKDOx7DBY2UWMNfPZJ/nNjYElPm039z9zKTH07cDvtgNTEP1?= =?us-ascii?Q?8Jb7DhEYH2nWJLHUvCwybY30kixGbuTaSbVzZZchj6t1/jkEdTKvOYktKOvU?= =?us-ascii?Q?OQbBjU/ly/9E4AT3uKzL4ER88QgxyGPf82HPjadjqmwKiIssVrnsnq/UWn62?= =?us-ascii?Q?Sx6xqn0R4JZfY/16k8+mEF6x5LrTxINzrHI9J7uOBwIHNx9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LPgVBSOAQwCtRiJX0OJjZtcHVxwVpwOWnF6Wtp4ni?= =?us-ascii?Q?Ky3/i+FnBmT63wXibR/NCNBd8P/k07MQn9TB0mblL7scC5DjJNhychiZ3ZB1?= =?us-ascii?Q?T8J2T27gArs5ROUrSZOBQ7RiUZ4qmdhzVcanBqaK9BFi3hVXhqMYhcYnGisQ?= =?us-ascii?Q?k/OSDdYoFEd3j2scvApLYGcQ7JKHg2DfWNoS9aTrNWfpSrDza6ByC9tNFKd+?= =?us-ascii?Q?hmPnmC6oMrhJKD8vaBjYukDpCdUM5e/ZGPh1VpJTz2BVP0g8B3mm9OiqTuMl?= =?us-ascii?Q?whm9XDcd3YJ+UKXMgs68uxY8++VTYw12mVo/DaZw3YEfmVQ3Qta5LkJc+GUw?= =?us-ascii?Q?+g=3D=3D?= X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 39622226-0726-4323-59ef-08dce9c92e4e X-MS-Exchange-CrossTenant-AuthSource: PAWPR07MB9688.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2024 07:49:05.5045 (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: ahZuHPJ+ygMQVDOfTq1pZiewLK5y9kaMHcnXD6ZnNj+qB9tpIIyflG2ICMzAjbWmLsxQCbuF07qQz49Zi/NoYkHQTLgA2beDGQH0LNXCQ24= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR07MB6922 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 | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 268e77196753..b18eb4ad21e4 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -1884,18 +1884,23 @@ 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); @@ -1905,12 +1910,11 @@ int ip6mr_ioctl(struct sock *sk, int cmd, void *arg) rcu_read_unlock(); return 0; } - 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) { @@ -1920,11 +1924,16 @@ int ip6mr_ioctl(struct sock *sk, int cmd, void *arg) rcu_read_unlock(); return 0; } - 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 09:54:28 2024 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2041.outbound.protection.outlook.com [40.107.21.41]) (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 CB1AA20ADD3; Fri, 11 Oct 2024 07:49:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728632951; cv=fail; b=orrMBZ28UCWx/lOwpTTFk1uxffiqF+PNu4AXHw1u85c1SYpiSII2YIGW8PIp2I7g/fsD4DiSX5gX7B8dL1dZmWKLWxk0V2X1I2+rIP9O/sNwPiiH4mfNfrHVCwAogcNcUWOYfaDUkHGUySpQ33YvL6Fr5pK9kmPMjZigaIiAU5s= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728632951; c=relaxed/simple; bh=v7H/ZbYfUPmdLijyW/7AjMRy/iFQ9cv2Hzvpanhjp/M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=s5ACvkRPNy+7KjQxLlkWoFnByCTt0GC1MN7bd0SVJ9cAWH7BRdoqRDoPgz57hf7qtOO7J8dPZ1bVBZnk8sMtzV10LdxkLcIOhOCeobuh5jFxzJRQFB57hGOo/n8WwRQu9euyyZ6bE9V3se8qBU8ovXJIiPS61AMacEtFMuTvcCE= 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=rzL0302N; arc=fail smtp.client-ip=40.107.21.41 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="rzL0302N" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BrTJW5vkEuNcqVE1MVZyXEOMM3VNJ+KF0nidd7ZS3TyzyCLmVI56m+XhKTVDBniVeHhbyefiHCkfSG4bh8PQiGEAbWEF4jYeoCmzSQuVah+j3i9c+O0Dd4n5TMUxwmGh3idQ4HynoAkxGU7YCPqJEi3Aj1LGAMsjWfFMfaG2FPaVtm/MKYhT/S+zByg5TbtPSuqjQqb5yEQyBrkIdDOk0qfTBHVW9NJFu2NrBVIi1R51SdVufnD/f7JL3ajg3d+dMqmxIUPanrtOaatI2RSbO9ak+UEBbko9M64mRBRxEf+hUQ6Q2fJQVuR+YxMybb6NRZuqUYMtwiYPlE+5bzUfMA== 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=hBmCVJFmHLvxtaOHAsoEWu8L3Xc2oBXjKo1xzbnYNE8=; b=KvSlye7CHKTyuHH6M3m/FSOLv4SdP8yRfeuaGJD1WLJt4NRa97OjJ3OdrbK/aRHlBWGuwDV7DnWOCOYJ0dY7D4WzIIXY0oI28rTqiquIuYwYmXPYyy506h+8sJo3QQaPUSgHqdm8yATimLfnrvOcyrPe4sqyDUDY+NsNrPRreM8UTpnZCTAKewmSHSK6oQ726DQdtXiDR74+c0tZjNsdlBpaK2Cm02KhbuIePruNUgoJOtd4YR0sd5DLJx6DNDYMVh+geYgFfOjlvLftDwtFOl2NpOFcSiL+qI+sks3DREJELZan+h9er364gKFytDbAk/fWT7dBItwVkXrZLsqJvg== 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=hBmCVJFmHLvxtaOHAsoEWu8L3Xc2oBXjKo1xzbnYNE8=; b=rzL0302NmjAXBNr+lJZpA5iz0fwIbs28bIzHbbd98icsBsgTu2+J9qQaRSSFDYLjVwzr76gJIBCACFDXvtuSiyue6eDzXp1zYGLaH5u79gAmwg1AYb+2zTpHlPFEvHfQh1f6VVsnE9Y1gIJ/Ki3HMquV2Z1uwNVH2diFe0jF11abOXRWzA2f35Qwx1f7FScInkw3kT/CP9S3JOndpuiqZG35QOHPQraBOvo4E+++hy4+WwpBBfKWp/nnTV7C4E4Eyt09u39LfOK5AaTEkBz/mHHEyjGi8yS2q7nubvh+IyLCH51/UrBO2VqmBKTTztKVKscsY+A2K8kfiy7f8L4tPw== 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 DB9PR07MB10028.eurprd07.prod.outlook.com (2603:10a6:10:4cd::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Fri, 11 Oct 2024 07:49:06 +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.013; Fri, 11 Oct 2024 07:49:06 +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 v4 3/5] ip6mr: Lock RCU before ip6mr_get_table() call in ip6mr_compat_ioctl() Date: Fri, 11 Oct 2024 09:23:26 +0200 Message-ID: <20241011074811.2308043-7-stefan.wiehler@nokia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20241011074811.2308043-3-stefan.wiehler@nokia.com> References: <20241011074811.2308043-3-stefan.wiehler@nokia.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: FR2P281CA0175.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9f::12) 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_|DB9PR07MB10028:EE_ X-MS-Office365-Filtering-Correlation-Id: bea2a1a8-36dd-45da-bf5c-08dce9c92ee9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?STgPE71u3+mlnRwgvqourM6m1ieoC9c0SzE87d3kNxleKyXcy2/mWpbuSMjC?= =?us-ascii?Q?QfVyzKnQLYHy5FaaAhbEsWMNBcIw//d/H+l6NolJKHUGLC27Ne0IVci6wlcV?= =?us-ascii?Q?J8gKSrieUsSwLS+92HMuUb/khqbGNL8Qdl6AGVv1Tr+hJbCw91LcvPCxuEbT?= =?us-ascii?Q?5EGKzTZs362AID2FvTU8evrQSDnm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JTYCh0H4hTL0DYDjbqqZ3iqArlwNebSCJN60a1mqI8JhEYeEPKbnJKs5mfU?= =?us-ascii?Q?Yn2w7Wdy93cBDNMvpnfQ0qK2vlkY4ESw3Sakl3GrNDGQ4v2SrnvwF1rA6KbJ?= =?us-ascii?Q?OPYl1AykqlWEUq7q6u4V3o+8MU1MUiZdG+ND7A2rSQWvY+m4DEx+HXmOqJuj?= =?us-ascii?Q?56mb6oJq63kQOYx4fH7uiuO3+kVIDg8Cwp1wHNW7uDQyoTduexf2jmPPHRGf?= =?us-ascii?Q?4NTj5ik4ARKGGN0ZaFESNrHHUg1SttkO+nD2A9Gp5BMe5Q=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)(52116014)(376014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?brlg0Ubbk5lUZaEGLhPf3MUIVGsP/Tchs7VJ5ViCIJAJjBzb7zSeh3SsYOsA?= =?us-ascii?Q?HICUat47CtP8TPRGl31lSjP3i69XAFSR0LI67/KkW4vpWBXY+Q9ZRfOGmtSW?= =?us-ascii?Q?aMkTlDe6xQ7WYQVk2eJVbmHu21ji9ESQfWM4TwHXajD3sN4pGYrZNDGxugk2?= =?us-ascii?Q?OhdKPE9eGY9T7F65Ey7VKSkN/Sz5hrAgezdMIcJHRwsRWOHAgYEce8p2/RAU?= =?us-ascii?Q?rEtQbr3V6IJ2u3/7pMryd5cne39T8PCBBNnvQ+o/GB7/cYNx/YKT1NG8Op9y?= =?us-ascii?Q?kR8HQ+brJnA4Ig1mP/PHi0xrthrrHq4qxEpSYBLlre+o7ppcVLJdo2cydA7H?= =?us-ascii?Q?QKF1PKDHo1SqMy8mEKouOJgcPaJZ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KamS5v+21VWzIQe0uuGhimaVZSdFM/91gZWQ5zaJ1utCDLK43ZDe2U6Yui2?= =?us-ascii?Q?P/FtlHG0SYVJo+oyaMqa5CrLajIxqg/EQkm3DSmSZmItA7BiPFSL4MvwM9X7?= =?us-ascii?Q?2GO1E+hZNe7bLgiYXTUXJTsJxKlbtLKDJH5py/Fq4kTfino7KkIiovpZ0aub?= =?us-ascii?Q?i0nhuGwd9gTN6LVVYZPnKhIcDzoqyuJrWdEYfefh9XE26Yekj4kkGo4AKwtO?= =?us-ascii?Q?mv1erQznoXr4c+egeWh10of7uZCyWNcG3oStnVvD3aNPqBFAt9HTD18LozVW?= =?us-ascii?Q?LUarv71F7WZBvKT6278z++2wOytZ5TSelFG+hh4m7i5lgtbsvmbklfmNLY3X?= =?us-ascii?Q?hw=3D=3D?= X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: bea2a1a8-36dd-45da-bf5c-08dce9c92ee9 X-MS-Exchange-CrossTenant-AuthSource: PAWPR07MB9688.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2024 07:49:06.5282 (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: i+ycs09KaI5S0BiU1UK3djhoOlZ3e5l62Eniez9FkshkA4BKtdgZZdwmA+ekJ9FI++I1GwsYNBtx4qnTkn+puXSS871yIXtYN7CZPsGk2YE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR07MB10028 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 | 48 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index b18eb4ad21e4..1e233ee15d43 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); @@ -1987,12 +2004,9 @@ int ip6mr_compat_ioctl(struct sock *sk, unsigned int= cmd, void __user *arg) 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 +2018,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 09:54:28 2024 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2041.outbound.protection.outlook.com [40.107.21.41]) (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 D0AB220ADCC; Fri, 11 Oct 2024 07:49:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728632953; cv=fail; b=dG+bdNpcjfTXqnuX/1iPuI+8rKt/6oV7e9aIPW8g3Y+ZL6Z17aDusEC/VJ54/3X0caIqMsFaZyBaDeeTJR6L0kGofV4XXLL8+hP5KZ58EZP870mx6vrR+zRLdkcMk/MWTmRy9edH9csgSAjU0ePq9wadr5wCvRD6wAFCKDmPZtk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728632953; c=relaxed/simple; bh=gATSOGAPHy7oSau5YIF10oGetc7l843uRdQqrA5Ykek=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=Oliyqf5UCm65+Lu6B6qs4Ci30nCLxpJ/MRFOIsCrh+US7qIkvet+cV5/fIv9l/G1M15YzZQDAUREXFh1Koko+KpCHAE1234i0iqvM6P6o9LDGNtalDXfnCsdy/rER08iXN4BqxwVV4r1d52+gd/OILSyBNoRuMPkehkP096ipbw= 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=nQ11XvrD; arc=fail smtp.client-ip=40.107.21.41 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="nQ11XvrD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WtLnyfj2xdfT+jWslzVrclOiNSvP3IWnRCmEKCu0XxNVuW3nWFWm3PZIgn0i2ParZ0gq5ZauXueWaUtW0UC/7Dt44El5mI2uiYkzFwLql99CfdOgRMXsv7rx31Ld/UR33buzN5LucJQRI5TAFb2pW4RAh9fd+mFsjZSsQ5EOIcFd9OUpjIkEXI+XBHCQ7ACzoXGQ+opTWJWDzoRjYic35CdzkLq6eENHg91SIN+RgpEBKJCHZkhL0bMO26ogxCJw8ESzec2i+gDFoZndCxAxZfQAXkWLoFUbE5l2+ce/vMfdh3jDJX8HnF9GPqGmKchMjmzDd/MYrJ+SEBzqukeuLw== 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=2B1GpkF4tu72egQVDvAVI+CeZto2C1kTA1vIo04mBuY=; b=k9cjzhLypGwlg0ytUGdM8DnxOumiznm3BbGJEHlMcfoRXWY515feAUY95IxvFIr43EmeK/HvOrs8U1v3LTk72pWmDqmgYiOECLEl97ZLjFBOVHhDJz9OjdtZghZrTHpZ6IxK20+4RwSngEZU7laxs+ctnJveKE6QqWyLFs7r8Ng3/VJ8eo7d2drAUD8lfh84gydtiK/PkbBRTW1pZfzfgLguBF6YAUmZO2Isb4QQ3Cez20LXDS4t6MxkjDV9yqP8rAf5uIe7ezAL0nECQ5hKTYGzkS4kgGxhWR/Q3W31jk//C2PLHEBPg96LXd1xBdWp+1UsIZXP/U85uwRHAR2/7A== 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=2B1GpkF4tu72egQVDvAVI+CeZto2C1kTA1vIo04mBuY=; b=nQ11XvrDwehAgQtHKtjoIdsfhdU5tEIfrhjLcrbLBn8uymHEksoCT/Nu3kcpHukK4UPs7N/toZtOnn4aQrZEi8V0a+nSXVwv/VU8Dju8w9WPQamFNOn+ayUf0jNz0a10WQ0Irnp/CrW6Kyygyoh2YOuONuX7cmbclbPeCQy0Q4LZMKlJOWz21OQkyh6KaGwUskRj8grorb6CRDQX+K8Fa1KNflMBhJtySRcHHwW6jmFMVsWPbhDCZPeNxuqD/YS5FFrnVr/TfaVcQcsW9HJ/41goUsR3qTu7ECGowaor9fctc+Ihz+mZ4zv3pgPXyK13pCoPtP1OrrQiCt41tNufJg== 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 DB9PR07MB10028.eurprd07.prod.outlook.com (2603:10a6:10:4cd::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Fri, 11 Oct 2024 07:49:07 +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.013; Fri, 11 Oct 2024 07:49:07 +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 v4 4/5] ip6mr: Lock RCU before ip6mr_get_table() call in ip6mr_get_route() Date: Fri, 11 Oct 2024 09:23:27 +0200 Message-ID: <20241011074811.2308043-8-stefan.wiehler@nokia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20241011074811.2308043-3-stefan.wiehler@nokia.com> References: <20241011074811.2308043-3-stefan.wiehler@nokia.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: FR2P281CA0175.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9f::12) 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_|DB9PR07MB10028:EE_ X-MS-Office365-Filtering-Correlation-Id: f16a5b1d-fc39-4c16-a71b-08dce9c92f87 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?4+oHHKnZfGkC8aAXEOWsQvr2549b703Xew6QAbezuBQ4n7y4kwxn6qYKHCn6?= =?us-ascii?Q?lApZITquk6ODVa/qc9gHix79bQllbDIEjpG4cGWWYiTCFH8U53/+m8pYOHZn?= =?us-ascii?Q?j6gK994ZDdO8dMOHxWaGWytC5w8QoggWaWFkdefVwwkMTsJ5K3my4pB3cCyf?= =?us-ascii?Q?MP9vNMuTJCWTJjKTkHb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ROE7a?= =?us-ascii?Q?Hu7vSDyJGaUlyTJrN0RaC4KUgbjpcH2Rka0z0Pb20C6nXgeagV4S2mZKIIY8?= =?us-ascii?Q?WRApgwgMqLkU4UEvZ423aj/dQxn+yzHmfWxObw2ISEjZe1sL4cVRP9a1+R76?= =?us-ascii?Q?RqCsCAep8n77Oi9NM/jcuG6bUkpqyRJ9FcRNz8Tjbekul7zlNsNvzEJnzHlL?= =?us-ascii?Q?QRyHGdOlX99NGSZo1cpwxALehUcjh4b40mFw30zsUpAamaUlD5MwIdEPrKnk?= =?us-ascii?Q?Dr4UO/TBzXUXCxH7ofP6ZndmPc0C0lf0vRQcVyARmFa6xQ=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)(52116014)(376014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?A5S2NUrZdXbDPEumbmXSVHPCZSy7dRv2yG1vTn3Uqzodt8OAfKcPdn8Om7qE?= =?us-ascii?Q?EXWsaOYUNAPZtJD3pw6wdc2TwvhExnEWQjbmERE8W372p6AUoeb2rU28UIsS?= =?us-ascii?Q?eiJaPtJGLEOLLGwv7cubYK3+ZXRFiP7n3eiw+olymGrJ68ge5p28vUoD7ttt?= =?us-ascii?Q?bT5d9r9DPeykFY2srSygwM+bAkrp+sOR26eqoa62BlK2HgNth/ivlXGgWkBU?= =?us-ascii?Q?rVKGGAFGdtW5QajigArNbbTorazj7+w9OBfa5ZjTVcpjtysLorefZfN6C00+?= =?us-ascii?Q?6dmBSbeCQnkkgdmEvGPUUY5eGdwOvdqJKwP1I3An/dAmOvc5oVx7shrrqrrI?= =?us-ascii?Q?c838qfasRWvkuNi57jEX0KG/biP9ykJqEAlAkdP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xxTm1sijvtJzrHDCi6UGPvdf75IlPdAXq6IXdDhIO+qGb?= =?us-ascii?Q?2IjPI9yClZUOn67aDLv+EZXylGe9YYRRubS8pFlf8hmQ4lsgbyRK+mfGhWSs?= =?us-ascii?Q?gowBrraBDEvkELyr2K6Wjs4wMLxl797qsuEoFLuuHOVGZ+j/vMkj2QAPfiUc?= =?us-ascii?Q?tXl87Yimj1kSFj2kT+BVdwkyWr/7L8tvtD0BsYHJfH7dd67ghwCLx057Nxp0?= =?us-ascii?Q?uMcHYVmSJvO4PDGmAX+nkG/4VCWe8zodrT0Nh0z302DLoUTlbZqMQuu2/tJn?= =?us-ascii?Q?lD6RMlcqs2J6YF8A2tPZn7HjObFHDbLw2ketHkRNAH5JixTQsUdhrKFre5tv?= =?us-ascii?Q?4A=3D=3D?= X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: f16a5b1d-fc39-4c16-a71b-08dce9c92f87 X-MS-Exchange-CrossTenant-AuthSource: PAWPR07MB9688.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2024 07:49:07.5824 (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: zYi3UPMMRWvjXGkUmjdLk3o7F1B2Tkz+jKRTBEE4fBXV9txByaQZIQICit04k37HrD9cSrKMa1czpPNPZpNeWid00+L7l9nPB1LTlqre3No= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR07MB10028 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 1e233ee15d43..a817b688473a 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -2300,11 +2300,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); @@ -2322,15 +2324,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; @@ -2352,12 +2354,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 09:54:28 2024 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2041.outbound.protection.outlook.com [40.107.21.41]) (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 D2D7720C460; Fri, 11 Oct 2024 07:49:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728632955; cv=fail; b=sQN9+vw07LrD1LyHdm9M+x8QhwZMhl13jNuVtiU8+9O2H3Wo7ox+8LRzvTS5sQZVqmf1ENTjT+aZIQ49O2O/loLQ5J0eQywlsOZ253oE6YCLsdBohH1OXc5gHXu8JHHJfJmSYA6BMexzsZ1+xhG3fZ8X8NYANdwS6bagtoXEgRw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728632955; c=relaxed/simple; bh=0TZBWaT8/m2CB3ub0+FGUA21FoqKUXG+bYXQtNb/i1I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=G5ebxBmz5iC5zMOToBKWH9jCcXr7Vwagsu7t6QZ2Yv0OmVnCqBdv2RKRrM1YU5ffHI7133oFi8D9LVWI7hmUmx92T44NRgUYiI9LDE9vN9ll3k2KayEecuDnPhUMLjtUl1GmI3kzcLj+5lu1Ct3XLz6tGzmL5j43JjahtRLpxhQ= 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=Q8ARyHai; arc=fail smtp.client-ip=40.107.21.41 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="Q8ARyHai" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Gmid/qnCVlCtmt5UxTOm1RNfIgJjlyQdPaoBqOQ1Sdizbm/1q0zp4cNPDAmLFCylN02M8yGEe7sMwuK0mCrVVI3MH09PxJWwsr8Dpq6cXrSkcyzDa4x6rTv465N6ZZfZP8Gkafh/sz8ZUSNRgfvBMbctFco6VxUn4gAaVM629UplvlElHsICSQlUYJ4NgLvRKmfi7LO34dWrkkOtyKQxQY/Oi9s5MLa18KqN6i1dk62LrVZCtHm5REU7Zon+hE9U8x5IRKfWsNzZ0FLbLP/Bevlf8oALB5XO17Lh/Z6+WJS6NLbiD3b60BWW2GvHhvFGYHP4C36efw/GbUYjbLf/2Q== 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=yPfSonQcYqCmQH4rzpVWQ7ao5gpbLP1Z7dagYjM8uXc=; b=DVwa/b1WzgCGOGpeCNOehVehl65xLfMqzW8QiRxk9PMBQI/oD0OSS7DNYAwh4LQgkBVI01bcRfmNmjDrZScbKf0nZzj9hInhs/00gHNTfC6zun8qj97KleilZhtuHyBfpsu3/OYAddXdcNjVAb2aaU+vURMrbeqcE6sxv0KqQUkqNUf+SaqkLQ9xuM7OkgpcegnVPVwiRkkbqxBamFYpVn2e4LP7wgs+m/1FT0tAXooX5bAAPbRP5LnudFhbNl0mwt3MH3IHBYLCqe+9KkrMLFh6FcmXNvG9wWxMTh5phUIjP0tdQ8LRnD/lFP3kZtlDcep7O2pxo6S0bgeqgkr1yQ== 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=yPfSonQcYqCmQH4rzpVWQ7ao5gpbLP1Z7dagYjM8uXc=; b=Q8ARyHaiRBeSMlk0A/M25b2HBfVzt344KMiYLH5Q6RlmoapvNjWhs84/2sgEA10ILQd7NuKcioHhqe9ui/ZH3VHA19dAL2yXBwRNXG81ujYgM5nuq+/sMNrLVubCqIJOTI6MThzDt8jQjq/XqmVNavekd2UJm+9VhflE7hVP8beb8f32IcVktYTQg/hBSAG7hwGVukqw96T4A4X1IZS0rwc8MRL3XWxPUMsn93PTvEeL8hLX0D1GeOhx34xfg3IPlVmlyP4vGpRVoc1QZDMWD3oM9FELQoOsMFvFQbZ+bQsqZ4E5T7S9iBATkjLI+Jxe16YkQujXoq1GG3hGlNaL1g== 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 DB9PR07MB10028.eurprd07.prod.outlook.com (2603:10a6:10:4cd::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Fri, 11 Oct 2024 07:49: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.013; Fri, 11 Oct 2024 07:49: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 v4 5/5] Revert "ipv6: Fix suspicious RCU usage warning in ip6mr" Date: Fri, 11 Oct 2024 09:23:28 +0200 Message-ID: <20241011074811.2308043-9-stefan.wiehler@nokia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20241011074811.2308043-3-stefan.wiehler@nokia.com> References: <20241011074811.2308043-3-stefan.wiehler@nokia.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: FR2P281CA0175.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9f::12) 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_|DB9PR07MB10028:EE_ X-MS-Office365-Filtering-Correlation-Id: d0f3eece-5f67-471e-7724-08dce9c93047 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?fJ8ahpUYfaAylsmjUUo5oOAIb88+LJSPtthtHICNlUIl0AjTl9NtKRkTmzZt?= =?us-ascii?Q?treXHNSAPuQxnHutCf82eB8Xn+ldCDcOWA2J1MUpDJ3ej416QyVZkj57tHuZ?= =?us-ascii?Q?ytNIiA++SB0wiyIgXG5fQd3nR3GIKyg9CKcYxC0daX4RzNJQQ2Fbmav6dthX?= =?us-ascii?Q?3EvgOVTu/L2m6CusJlYR4imYDBL8WpUfBGXm5hULgmBKozVZLfdyGg5SeMAz?= =?us-ascii?Q?nGyWJcMpstEOUvARgPc08l158z54Wole+p8kL+0B/bLDUI03kiOf/Pp7/cRT?= =?us-ascii?Q?XEp2Df4xVtOCwX0lw9t+3z0QrLo0O4xj2P7mHISGQtn+nxzhMlHTIv2Flhri?= =?us-ascii?Q?Uq6oB6DjiWdXWI7x13glA0JLoeqzFi/RhMZNiPQ7iwTdoXEJTwkD6ANksAJi?= =?us-ascii?Q?HI8w5eBk+fFCR0LWDSwWiH5KCr6fTeabxIdi41PGG1kd6FjgZFlznQw8bMyi?= =?us-asc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QYA=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)(52116014)(376014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?4Ras1qTfUGx5qpCV5aqm3FdinYlLzI3tWe66WzsCmyXdm1+kV451va16Ftcx?= =?us-ascii?Q?0qGFETQB0TOWPOwLg1sET+rT4IDAd7vorWteVwiuZHsv75I5Qrb3T5R1ijW4?= =?us-ascii?Q?NFwhGAbbqlARMHFxGoUOE6Q8Xp8jFwDf1pGEH5Yifmp/s22jey0fLtsWLk+V?= =?us-ascii?Q?UZQnWXw6IOZOGKmFaIPYMdLZfuc+k1wlnZLfqKrDTFSUB0ix+kNHYrnUxOHO?= =?us-ascii?Q?khkmJUpbOPCJfs+CZ3vb1QR9auytnm34tlg6rMTOzi/CkH2zglJ2KNXaVxGy?= =?us-ascii?Q?rrO6n3LGVZ/8/Qd3yjZpQVNEu5ice0AxPmdkW+LpYGfqTtz0bAToffADyDuZ?= =?us-ascii?Q?d3d2tDSNHqiTQu19+4jQp5Hdagqn9bnNvzUXL9k3PCMefQobBSglkh9kTk2q?= =?us-ascii?Q?7xztTPwA/GepKbM35gDqB3ne/KIDyeQNY8Wf9CpqhBSKizx6gvPVFiDjmCyJ?= =?us-ascii?Q?17165sPg0lMiTBDXhH46DSwGorfzqMKkd+7Xpm9TtLs2+uVcjx7OgQLaASHA?= =?us-ascii?Q?Pg2/q6xXxz6GofsB7ytsZaslF8YSlBcAfIO3g8S6TFGPVT8uNs+HFrguBwQd?= =?us-ascii?Q?oBkpxMF593/o4Yuz82vfMpAPffE2m3Uiz1ljXiHciJR/LBFeHVmIx9pmTw+3?= =?us-ascii?Q?9iB2txa6lrPTZg8uz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WgB?= =?us-ascii?Q?7a/zBw61hF28RqiwEcLK5m+9iwNNAOIY02HDx3qrazrg85jU+gQrPsoUSiW6?= =?us-ascii?Q?vA=3D=3D?= X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0f3eece-5f67-471e-7724-08dce9c93047 X-MS-Exchange-CrossTenant-AuthSource: PAWPR07MB9688.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2024 07:49:08.8348 (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: E5M9kwwVd4OW8XMlksFHRqfv1FpfFeDZJek7aDmEEU6J8jvGjHB4R/IT/IGGcCYT4sdOROeIQ1QshS7D2+Qdkzu9NXKEp2gbOCUEhoMuKjQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR07MB10028 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 a817b688473a..44e2b4d1ca23 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