From patchwork Fri Oct 11 07:23:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wiehler X-Patchwork-Id: 13832200 X-Patchwork-Delegate: kuba@kernel.org 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> 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: netdev@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: Df5R+ieoCCUdgJC9RkU0jf1aMCOCQlGdM0hUIN4K9AdU5eDlAZ2CebjN03o0eP5olV9USmwgPdQztb1bLfsFymzwAmMh7ZUwlU4OFTHmcd0hPqtjhMMOgz2jwCDIo/yQ7qrzHO5K1zyJckAdV5tz6q6NC4CGVnECOF/exAyaoLHBtSNZra8ocIN+0FEmMQzDnA2fhUQHmLv9dhZi8EfYagysu72M38w9hVFjYw397a2p3QOwz+XgakVBGnjObR9TjbEezBeV7CG309waW3+v/T/iHCwfYbH5wERADwdOKq5H7rrdHINKMMzC4MLmCo/qIWiKz9i5gqNrH4ovWCiVrP6vXPu1/QyZyohGMMrN7shtOuYv858r/leoR6H7l6xdDdoJqeCcUDg1KV+DcILhLCCgJ+rv9D3M+IxEbvhqtTe6VvmeNLsfmFV6zejFAQmmh03vMEyE/dg15KUkxlhHYU+xGqMSRvrBe4ybuHDzqMUctSODPo9VQCldO6/xhi+QLUewIKt8y8BacrBVudd3EJkSwoXtOABlRP/UVpq7nx+1UFDD7QEMAGDg3Rp2PSGKSinRY+jgbcDYL/FOdOlWSwpPxZYdxQjmuzI432vaZ5X2xWDxCzIPiCdsHuOpeKVVoHTQnYmUPByXP1GkmtAT0jOquPBw1an+aTPCPxSZ+RCSN43QC5GJ1dLl1ngGK3aL1DlDbZL/MmR16eMBjWk/dw5RhiSkLbADbBO9/f9tnRHEFllNHUPQUX4PHTuKHKE/BpqYIClAa1EvdWddO/vDwL0LLLww2HecY7oz9eE1NAQ65GJzmWqoD4DrEdwK2Y/K6nj5p4T+wz045V2AXy3Qr8zacMGfreZekvcfCz3cO10bt5q+dygaL2GJaCXEHriARxUvTVRRoajEZxr27BumeZYHj+uiGwRprfW2V/0OINYexXzE6gWKP4TmxI1bnuee3dLFdu6EQGv8JXkGgy90w7N9/gMWHe+DKyLNsFWozqAIS4LVmCd1Lt6coWnVFBDW3ABpIfn/DeY/C+AYafUYEP+O1cmuxF3MzSNRnmmRO/IB/CjziTLRP/BNInwg4DE75z1+Ffbl747A8i5xIwxL+6SdHWJLYxFeVeDCOhQ2Vxq9wm8Q62WVx2Hn11jNusgIs1fHUwljSLoqobODyedpnIrDr57CocpbAD2k/TXGcn6lS1joIwBQZWUiAwPv+8thFyP2xHhWa8DAEib82ZDkrn1oTBfUQqZQvU95W7RvN46Wig807deF56oa0WhD0n+pPYPy5Q9XZnSH4k46bSM5dSPLs7d9LQ+4CYgblDcIJJLCTe9V10L440rvC0HVHoM550dpDMFTY9+MfA31B1+P2A== 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: RlqlSUzBgntMTI9u6AH3x52M6BN7Xn3KHS97HSt2Ge/eX3zV5c8YppNW9AsohhFmvpl0eetQvRVS5vk5Z7f16qNAb1kILB2vhblSD9KOKICdXMtdvQxDnSEDmZ20Pc4w5mU2PxSGXuUWTTYRMixMWBPfG4AkYecY42Q0mkus5YwE+Fhczy+AIia4EK9jga9niq+iDq2+KLHoRW9ie9tI8R6HtpeQJtNTOUSeq6t9xc69J7CPbDB4KL1zOhUIy9s2XnyWZ8g2Galk9nQ6FCaLtj93zVvkhuNBQjVqtwYheLJ9Zho4qx2U8Xkls8EsgGfAfGsohr2hZVADl5FkQEIhr/FDjZXnbkPFZ9QpCtA6hpNpRuCnBJLPGeTC9P6m0w7AetEaj1tgGtEv8PxfJlgiDrETUy2V0gFObfEYVistyupQ3dvdbMwYqMpRmOlcMsdA4KEWa9eEhPJdeeZoTWrZ2onNSos+2zlv3vGIAba33kpo8FIgmqXj0aSp1VMIqESNBAmgFdoAWcGbjEnlZGy7AZwUkWOhhf6XDOph72+H8j4IVI9NcL+MBvLRfL9JlZwC2jVODAKBYUrPiugMBSkiTD/jl9L6BfvVUCRNVVx7hMw08bgLeMk13dM8gYTfQIQr9Njyse+hMlSl+TNuAWQj/jtBPjuBuKJzJJLcjBcTQ61BWxhJMylKKpuzbZ62GyEqLsZ+r519WQWaqSao2iazqIJcFZbV6O6rZpu64L+zV78Yh+OuOZcgGJLB9GQW8nmQK/6a309u8X9W24zK4Ime5JKYZjZ0/YiJAtybnongFV2DyctNncsJCzPlAR7AqUMiI4dS2OhLu4vxYej6RwBAHEMrGKDDRGouUzmkVWZp+6fnXq8V0oNljUcv7mMF8eGeqhLVNBP1EZ1rn9Jryqowu3dmU6ya/DUzuqgKzOiglK3KNUx8YoV44NSer2j/cKrxnRFda1OgEvoPWHAqU524YU5q0d7bldFnM3ILLDWj9RZkD5nNfK0ItCCLCz8M/0415nDZapeUt2yLp9V6JU2JcEmxpreJklrlvNH7r7aon6Od3QI4ejQPwmyduMaDCmhnreXPdjg7wpItDIN592GmMIpP/kPKVWi1a9XQ6WQngsSe5/zNG2exInU+kkS2P/dAtJav9zRYOVCMFpz1Qp5qnEJuAhN+tViAFIOFZ6/w+5FgAtNl+tUHfzYRxLiihPyYQ7LU5cFH6JMK2+EZkRslunk7F2BY2Vf1sLK1NbmUYtqiHeeVkOjGFoUZEi9dwX0xuYWFphcvYC1HgJbvTCoSHPiXbeBwtfwcz1YX6lysZ0GNUdqoAm1AEdXYtQwWxTPkDRy6b30l6z2vfHshjBHxJCvR1eFa3rew+ilzOb6O3tcYQNoqBgJhKktp78gzMPl5ok5LJ0htSjttOMVxHQHk0R8z0dhhcltT2BzqwgVXbFY0Ldnhy8R+0q7x2Z5Ny6Fv3Zi+FzQTS8RV663gOk+ircDNe/BNhCdbZegrxjwR1CPfX52eQkrYqEws7xUYvB+lb5XKemsSn2CFdnblY2Yb/0cG69bxi/kaSxU/2RJCeePhiPkxamuYDQq9LKqYdRQH1cj+6qOJ1EMGs2YzpPRq2g== 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 X-Patchwork-Delegate: kuba@kernel.org 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 = seq_file_net(seq); struct mr_table *mrt; + rcu_read_lock(); mrt = ip6mr_get_table(net, RT6_TABLE_DFLT); if (!mrt) return ERR_PTR(-ENOENT); iter->mrt = mrt; - rcu_read_lock(); return mr_vif_seq_start(seq, pos); } From patchwork Fri Oct 11 07:23:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wiehler X-Patchwork-Id: 13832201 X-Patchwork-Delegate: kuba@kernel.org 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> 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: netdev@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: 2kMuBF3jzETtEU3aSCpFXE/J+/w9geClJ2Yb1wPebOwjyvDz+93sdsdS1EZE1JlcLSiVGSFoJgXOlM1T8iGiiCpg2ueHRtuYOv5eGaTriDhaFcTxOP+8QONf9SH8H1qHxsQ49ret90qN9LLLCVCzrO0tTpaPsSOtTKSa2CBTxFflZ+R8tA0VLUStJISNGy14BUicjyzjRmmW/vpQWEFLHq4ww5hBAydupZh4uOhBt4ZaaD0BCk2rOKLBzSMV7+Q9aS9mIxOlQeq5PQPwVFxdBJfmqPUbOR4bsq9wV1LR623RbOWmckpyFP24we9d90GbUkyOs9dG1GNWaVbowV3jw/w6bUrO8UD1pKYW4qJAkCcuJyUlgC9yrdsdDmw74qtNPgSiws8irhmF5xP/dedw9KxOw6HDe6CspeRjjKmRHWsEjeCTVz8eHGHIByn/NpZ+J0zvHSv6LYnQLbIL2RYq3JXlr7pMI5ORCh96qXQYvSb8OmTeumw7c2wdX1zL+I2jTeEdhoAdhkJ2ZzrxEe5/Rwjct8mEiXoKCcYhVROUumJjWIQbVXXMz10KYZbCWu92OPLoOdV/VifBkgdJHzu4jWol5kVy5/R5kDKUDbXDSq0F4VRV6qy6JPnigRteiob2yKnTBovMTDcf/s9/0X4T1luVEaaPUIW/lz5jbPXYklB1cdGZ1O7tK9F/XQWkCj9MIAUcIEpkfcD22/6aePN4ZOZ2HqcHrqIRYWSkWwH/qUrAMn7RUf/QepYbTXhLe4AUqEO42orMn3mshk7PYlYuUYnnLERndIcTjOFfHdFfCFJNbNUfPk+sxMnqOlixgOpJSIHzvzVm23bIMxKz7tuMHjwUJyBL/CirGmcFahaJEsSUp4SB1BlU1PwU/tGmHGL233DBudG3Cl8q0AZdX7Fad8M11YBGBOS4Inc3Cr6d8PSQQ4GUuYQx5U30KJe6CPttJjT+lVLkN43KoFcmGAoHNULGlgtjcJs9tmbGSyHyWs4nbi40AYKRoTHXZ+OTYCAE6AiDliIXNtY9xtlDH++V1+flRKbu+i8l0eApsFPKgUCYJfTnq58TsSyd3ZoP6gPpc7My9/+/Yl/G9grB/+RzOyEpcuNAmFHjQvsfi+ZWIkhFt823LoFI38ahUZE+N7EpsYJjTMMgzS51MeNLs3X5m2u3khY19IOaT9rdq4Sh9U8SbTYKTBnBrpPoCZgSc6LA7FYnCqMFxCCZ/awuy1ojrmEFC97/X+E7JxKODkWsR5onwllRnuCQcMEEckb2DqQYnLoudkl9zRmPjl+sW1U1kg1+CvyLYDbudeLhV1rDACYU3beW40DTVa1DAlYqzN16a8ZjGtPvYRPY4AbLwtMlXA== 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: YmMpSHzv/CQ8bmElVklvAdfjuXTGflXxzrsfNxIhPcOU2Dnk1NVEqapIqQHKK61BN9TmoxObKu3AEesHQtwVUoZ6+KeREvaGrraqKYXkEtuN72/108Oa8bVZTjl3XddmgJv+vox+4GMrcmtbycOPy31esdoVoyKbe4edWTPKKPMVnkL9zuQpAe59M2n2FjbNLKDOx7DBY2UWMNfPZJ/nNjYElPm039z9zKTH07cDvtgNTEP18Jb7DhEYH2nWJLHUvCwybY30kixGbuTaSbVzZZchj6t1/jkEdTKvOYktKOvUOQbBjU/ly/9E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SZOBQ7RiUZ4qmdhzVcanBqaK9BFi3hVXhqMYhcYnGisQk/OSDdYoFEd3j2scvApLYGcQ7JKHg2DfWNoS9aTrNWfpSrDza6ByC9tNFKd+hmPnmC6oMrhJKD8vaBjYukDpCdUM5e/ZGPh1VpJTz2BVP0g8B3mm9OiqTuMlwhm9XDcd3YJ+UKXMgs68uxY8++VTYw12mVo/DaZw3YEfmVQ3Qta5LkJc+GUw+g== 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 X-Patchwork-Delegate: kuba@kernel.org 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 section!! [ 48.834654] other info that might help us debug this: [ 48.834656] rcu_scheduler_active = 2, debug_locks = 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: 0000000000000010 [ 48.834782] RAX: ffffffffffffffda RBX: 000000000171cd80 RCX: 00007fda5f56e2ac [ 48.834784] RDX: 00007fff52d4bdb0 RSI: 0000000000008913 RDI: 0000000000000003 [ 48.834787] RBP: 000000000171cd30 R08: 0000000000000007 R09: 000000000000003c [ 48.834789] R10: 0000000000000004 R11: 0000000000000246 R12: 0000000000000003 [ 48.834791] R13: 0000000000000000 R14: 0000000000000004 R15: 000000000040d43c [ 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 = sock_net(sk); struct mr_table *mrt; + int err; + rcu_read_lock(); mrt = ip6mr_get_table(net, raw6_sk(sk)->ip6mr_table ? : RT6_TABLE_DFLT); - if (!mrt) - return -ENOENT; + if (!mrt) { + err = -ENOENT; + goto out; + } switch (cmd) { case SIOCGETMIFCNT_IN6: vr = (struct sioc_mif_req6 *)arg; - if (vr->mifi >= mrt->maxvif) - return -EINVAL; + if (vr->mifi >= mrt->maxvif) { + err = -EINVAL; + goto out; + } vr->mifi = array_index_nospec(vr->mifi, mrt->maxvif); - rcu_read_lock(); vif = &mrt->vif_table[vr->mifi]; if (VIF_EXISTS(mrt, vr->mifi)) { vr->icount = 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 = -EADDRNOTAVAIL; + goto out; case SIOCGETSGCNT_IN6: sr = (struct sioc_sg_req6 *)arg; - rcu_read_lock(); c = 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 = -EADDRNOTAVAIL; + goto out; default: - return -ENOIOCTLCMD; + err = -ENOIOCTLCMD; + goto out; } + +out: + rcu_read_unlock(); + return err; } #ifdef CONFIG_COMPAT From patchwork Fri Oct 11 07:23:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wiehler X-Patchwork-Id: 13832202 X-Patchwork-Delegate: kuba@kernel.org 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> 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: netdev@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: STgPE71u3+mlnRwgvqourM6m1ieoC9c0SzE87d3kNxleKyXcy2/mWpbuSMjCQfVyzKnQLYHy5FaaAhbEsWMNBcIw//d/H+l6NolJKHUGLC27Ne0IVci6wlcVJ8gKSrieUsSwLS+92HMuUb/khqbGNL8Qdl6AGVv1Tr+hJbCw91LcvPCxuEbT5EGKzTZs362AID2FvTU8evrQSDnm5hpvaLCXNTRejaBze5beRfyp5snT2NymeBFsA0Cih2tVKWesaMNGwLJKL6JJ0bjtM5gUF1tzRnNcn7nLYen3fZBQW8FAL9kNDQMRw4q/CJiH/YXWiQK5CPoks5grGVLBCgJgvNDob1UqrcGPfbCJtEBdfNVZtzLA7emNyvdgvG+2xkfa45n9V1hhiUlg+Mzas3Y8l0DLNi6mzp0dsxXsjeO7hJg4KBOK9g+gNJ6SHv6hxgDs+ARcqvJg0YIW4tiaAjr32wEvb0fv++6unHtnQoYrDpbzSXP5WeoAvHBw1LYTdtsnx3bJHJvBNWn/3p5x4aFnZqfs6c29qFk/4Ihhu/0NfaqATuYyvIOGsW+1IRYNUdxUAH1yMSHa70TZUZbHGSG16WC+x4wib13u7Itwno3r/TH3YdCZpqvcI9TA0dCLDrqk7oss8Ymt0dOiYP6XCbavpRtL73XXj91cblAAYhbQChcV7GEn/Y7/xAQmdgXmSj2Us4TvlDlfFL12W19m4lfC/TJpw2BAT69G1tFJKAKLfscqBs/xbgNyhCijxs757rD/3Tt6QuCr9/M3xN5JtS4gPNo8iJw7xSFPX6Be+OGAvP0tLLm4UvuCkx96OlI1JAD0FL7D76tP4jP6iNBS5ior8p8veRhXhLavD/kpSXNCMnugs55YQqFtVX5tUxfmug7n1N+CJX5D7TBJurOHIT561ws1m/KZuUFsT4immZVOTtr/yp/W5c+CnxExIyWs1XlbEL2bYW1JOD4oU14qk6OHjcT0jJ5xeyavm0ou7gZZzJFw8LAYk6Zj9eD76ocsED81WliK98P2h5sGaWNJGDibBFhgNC6AuV3UUMb6U2HPB1sT45Oh6Y/3os+F+JTYCh0H4hTL0DYDjbqqZ3iqArlwNebSCJN60a1mqI8JhEYeEPKbnJKs5mfUYn2w7Wdy93cBDNMvpnfQ0qK2vlkY4ESw3Sakl3GrNDGQ4v2SrnvwF1rA6KbJOPYl1AykqlWEUq7q6u4V3o+8MU1MUiZdG+ND7A2rSQWvY+m4DEx+HXmOqJuj56mb6oJq63kQOYx4fH7uiuO3+kVIDg8Cwp1wHNW7uDQyoTduexf2jmPPHRGf4NTj5ik4ARKGGN0ZaFESNrHHUg1SttkO+nD2A9Gp5BMe5Q== 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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0z3WPT2PigoZX1Qua8MAc5PHnDf4L7l/xh5NghW2CiR0XKBZ2voY5qxEQ/3L+W6DASXu54rJZaKC4GrvrTBkvzR+MMG5MmEY7EzSyT7XLw5g75amPUVOCa2NcQe/pijK10lLW8EWZzMK7jTZXmljlZhPKKuif5iJhAt28BXfmYL+cXCL6aprSVN4uSS40u3QKdHaLBv5SASaqwJzTg0opb1PfRBgRRrSUIEZodvnVxTVMUHFvmebjDiZYqwIDUrPyaWydwdKamS5v+21VWzIQe0uuGhimaVZSdFM/91gZWQ5zaJ1utCDLK43ZDe2U6Yui2P/FtlHG0SYVJo+oyaMqa5CrLajIxqg/EQkm3DSmSZmItA7BiPFSL4MvwM9X72GO1E+hZNe7bLgiYXTUXJTsJxKlbtLKDJH5py/Fq4kTfino7KkIiovpZ0aubi0nhuGwd9gTN6LVVYZPnKhIcDzoqyuJrWdEYfefh9XE26Yekj4kkGo4AKwtOmv1erQznoXr4c+egeWh10of7uZCyWNcG3oStnVvD3aNPqBFAt9HTD18LozVWLUarv71F7WZBvKT6278z++2wOytZ5TSelFG+hh4m7i5lgtbsvmbklfmNLY3Xhw== 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 X-Patchwork-Delegate: kuba@kernel.org 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 int cmd, void __user *arg) struct mfc6_cache *c; struct net *net = sock_net(sk); struct mr_table *mrt; - - mrt = ip6mr_get_table(net, raw6_sk(sk)->ip6mr_table ? : RT6_TABLE_DFLT); - if (!mrt) - return -ENOENT; + int err; switch (cmd) { case SIOCGETMIFCNT_IN6: if (copy_from_user(&vr, arg, sizeof(vr))) return -EFAULT; - if (vr.mifi >= 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 = ip6mr_get_table(net, raw6_sk(sk)->ip6mr_table ? : RT6_TABLE_DFLT); + if (!mrt) { + err = -ENOENT; + goto out; + } + + switch (cmd) { + case SIOCGETMIFCNT_IN6: + if (vr.mifi >= mrt->maxvif) { + err = -EINVAL; + goto out; + } vr.mifi = array_index_nospec(vr.mifi, mrt->maxvif); - rcu_read_lock(); vif = &mrt->vif_table[vr.mifi]; if (VIF_EXISTS(mrt, vr.mifi)) { vr.icount = 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 = -EADDRNOTAVAIL; + goto out; case SIOCGETSGCNT_IN6: - if (copy_from_user(&sr, arg, sizeof(sr))) - return -EFAULT; - - rcu_read_lock(); c = ip6mr_cache_find(mrt, &sr.src.sin6_addr, &sr.grp.sin6_addr); if (c) { sr.pktcnt = c->_c.mfc_un.res.pkt; @@ -2004,11 +2018,13 @@ int ip6mr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg) return -EFAULT; return 0; } - rcu_read_unlock(); - return -EADDRNOTAVAIL; - default: - return -ENOIOCTLCMD; + err = -EADDRNOTAVAIL; + goto out; } + +out: + rcu_read_unlock(); + return err; } #endif From patchwork Fri Oct 11 07:23:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wiehler X-Patchwork-Id: 13832203 X-Patchwork-Delegate: kuba@kernel.org 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> 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: netdev@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: 4+oHHKnZfGkC8aAXEOWsQvr2549b703Xew6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rka0z0Pb20C6nXgeagV4S2mZKIIY8WRApgwgMqLkU4UEvZ423aj/dQxn+yzHmfWxObw2ISEjZe1sL4cVRP9a1+R76RqCsCAep8n77Oi9NM/jcuG6bUkpqyRJ9FcRNz8Tjbekul7zlNsNvzEJnzHlLQRyHGdOlX99NGSZo1cpwxALehUcjh4b40mFw30zsUpAamaUlD5MwIdEPrKnkDr4UO/TBzXUXCxH7ofP6ZndmPc0C0lf0vRQcVyARmFa6xQ== 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: A5S2NUrZdXbDPEumbmXSVHPCZSy7dRv2yG1vTn3Uqzodt8OAfKcPdn8Om7qEEXWsaOYUNAPZtJD3pw6wdc2TwvhExnEWQjbmERE8W372p6AUoeb2rU28UIsSeiJaPtJGLEOLLGwv7cubYK3+ZXRFiP7n3eiw+olymGrJ68ge5p28vUoD7tttbT5d9r9DPeykFY2srSygwM+bAkrp+sOR26eqoa62BlK2HgNth/ivlXGgWkBUrVKGGAFGdtW5QajigArNbbTorazj7+w9OBfa5ZjTVcpjtysLorefZfN6C00+6dmBSbeCQnkkgdmEvGPUUY5eGdwOvdqJKwP1I3An/dAmOvc5oVx7shrrqrrIc838qfasRWvkuNi57jEX0KG/biP9ykJqEAlAkdPLT8ffcddx1/2P5wzt+8hFLoaZhnmbNjLMzTAQzLjwh/qcc4+yD5STxKRkhWbk+70HIN2rNSoVU/9+8cgf1KdVlCqP1Xnpe5a6MwtbMMe8C9u9gSxSXCvfdlSA7Nmch2I/iCrYj2TVIrRxU/EzWCiWuCwchaaX5T0BSwtQ20WTAuECtGKnsLryHxOSLXiKMUkz0b8gH/+U35VwC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92f87 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 X-Patchwork-Delegate: kuba@kernel.org 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 = dst_rt6_info(skb_dst(skb)); + rcu_read_lock(); mrt = ip6mr_get_table(net, RT6_TABLE_DFLT); - if (!mrt) - return -ENOENT; + if (!mrt) { + err = -ENOENT; + goto out; + } - rcu_read_lock(); cache = ip6mr_cache_find(mrt, &rt->rt6i_src.addr, &rt->rt6i_dst.addr); if (!cache && skb->dev) { int vif = ip6mr_find_vif(mrt, skb->dev); @@ -2322,15 +2324,15 @@ int ip6mr_get_route(struct net *net, struct sk_buff *skb, struct rtmsg *rtm, dev = skb->dev; if (!dev || (vif = ip6mr_find_vif(mrt, dev)) < 0) { - rcu_read_unlock(); - return -ENODEV; + err = -ENODEV; + goto out; } /* really correct? */ skb2 = alloc_skb(sizeof(struct ipv6hdr), GFP_ATOMIC); if (!skb2) { - rcu_read_unlock(); - return -ENOMEM; + err = -ENOMEM; + goto out; } NETLINK_CB(skb2).portid = portid; @@ -2352,12 +2354,13 @@ int ip6mr_get_route(struct net *net, struct sk_buff *skb, struct rtmsg *rtm, iph->daddr = rt->rt6i_dst.addr; err = ip6mr_cache_unresolved(mrt, vif, skb2, dev); - rcu_read_unlock(); - return err; + goto out; } err = mr_fill_mroute(mrt, skb, &cache->_c, rtm); + +out: rcu_read_unlock(); return err; } From patchwork Fri Oct 11 07:23:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wiehler X-Patchwork-Id: 13832204 X-Patchwork-Delegate: kuba@kernel.org 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> 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: netdev@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-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plvI7+Y3THF9FpkLxKE/DCa+83puLTUVLe8vfikcxrTdevJLr1Jv6tLYG4xD62KngZX/a9gxMgVUu/qV+gEh7sYwNbZcSH+4ghXB53f5ASovn0xXGbqK8TEfFxKAH5b0AQDQ/3CqlFKjCLIj5FneV8Lm1O0lQALLCQEqcYul/gDrQ9rM9hI2flGj7FovUMIkfovvQm5ruFr6JkcAyw8lF3lXd2ypFK862Zu5JrObQMNPqm31HUyvZ/ExebjpGDcqGs1kGUEMp2Lq583Tuza3ym+VQYA== 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: 4Ras1qTfUGx5qpCV5aqm3FdinYlLzI3tWe66WzsCmyXdm1+kV451va16Ftcx0qGFETQB0TOWPOwLg1sET+rT4IDAd7vorWteVwiuZHsv75I5Qrb3T5R1ijW4NFwhGAbbqlARMHFxGoUOE6Q8Xp8jFwDf1pGEH5Yifmp/s22jey0fLtsWLk+VUZQnWXw6IOZOGKmFaIPYMdLZfuc+k1wlnZLfqKrDTFSUB0ix+kNHYrnUxOHOkhkmJUpbOPCJfs+CZ3vb1QR9auytnm34tlg6rMTOzi/CkH2zglJ2KNXaVxGyrrO6n3LGVZ/8/Qd3yjZpQVNEu5ice0AxPmdkW+LpYGfqTtz0bAToffADyDuZd3d2tDSNHqiTQu19+4jQp5Hdagqn9bnNvzUXL9k3PCMefQobBSglkh9kTk2q7xztTPwA/GepKbM35gDqB3ne/KIDyeQNY8Wf9CpqhBSKizx6gvPVFiDjmCyJ17165sPg0lMiTBDXhH46DSwGorfzqMKkd+7Xpm9TtLs2+uVcjx7OgQLaASHAPg2/q6xXxz6GofsB7ytsZaslF8YS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-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 X-Patchwork-Delegate: kuba@kernel.org 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()) static struct mr_table *ip6mr_mr_table_iter(struct net *net, struct mr_table *mrt)