From patchwork Mon Sep 20 21:42:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12506449 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA115C433EF for ; Mon, 20 Sep 2021 21:44:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 93122610A8 for ; Mon, 20 Sep 2021 21:44:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233821AbhITVqN (ORCPT ); Mon, 20 Sep 2021 17:46:13 -0400 Received: from mail-eopbgr150080.outbound.protection.outlook.com ([40.107.15.80]:61831 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S240143AbhITVoM (ORCPT ); Mon, 20 Sep 2021 17:44:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C8VDwP4lal5bN9vvOR92cqgqW91d5MNrl1QietVQ0mt8WdZIX7Y7mFvVu0d2jwVYq0iyPsIq/aTlKaMdyB2N0r3cCALVkeEcHioNiMLsTlT8CaWNLDXXPSDU8PeD4ew6dqrRqLhNMR99fpnxkUISVo2bybgncxweePi8CtP6al0FlfYdOccCJZalcQVAXFc4m12sWnVMS6YOuqChfkcxYFqBxikD0zMGSlf2jGDa629e3i9zvRp5qUjCWpmT7VWdYkxRASOdqg4/CKgmrNHyARHj+3mmM831koQ67MUa+FqD6wKIlDIV6QdDAvNav7YnD4uuPf12ELDWkZ6CV+8+gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=5rgNvva/MKeQs/T5q40/IqFG/xnDq4OuF/YrJDoWqhs=; b=cAnzZb2FQ/pUAms4Wwuc7VnE62TiRciRbEBdNc5mixkL1INL4ndA2EiIuXB7B3mqUY7WKm2+H95RqNouhAHt699OtRmNSTNHqoA+43NCrSskMRQiDzlbgeInpYaU1GSYx93DFYnM0uyM2Tn/SO0tNel+nCu5BEdBTukWx6gJKsChDwR5efGPOtrDW3IHL33RDMgEV9eeXLtnuN6kLkKG9vPpbKmoQWVII0N99/wvNuWHJYBG4RakUmAkSvki8PzQEpdifcOGmixHDapJn/k1wS2rxCuC39r/Vko26TVqKcFloqdv3M2+DPg3oN+CVLsxyEOCsTWjrVLca0R4GYBOcQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5rgNvva/MKeQs/T5q40/IqFG/xnDq4OuF/YrJDoWqhs=; b=WFX79GwxlHVlDHZivE22QUWNGyJM355i01ZoEqr9i6I599Tg/zqhs4d6mfql4Io1LMvg1ILc7uJ2rzR2XkpDwXpYagVHNjNgPN6mY6iwgTjzvvx4Vq9vNVtyXu/4xqpleOKjshzqTvJEDY04AErWw9vDDrv4kCWUsdcyNhWOucg= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VI1PR04MB3198.eurprd04.prod.outlook.com (2603:10a6:802:9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Mon, 20 Sep 2021 21:42:39 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::e157:3280:7bc3:18c4]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::e157:3280:7bc3:18c4%5]) with mapi id 15.20.4523.018; Mon, 20 Sep 2021 21:42:39 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Linus Walleij , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Bartosz Golaszewski , Wolfram Sang , linux-i2c@vger.kernel.org, Mark Brown , linux-spi@vger.kernel.org, =?utf-8?q?Alvin?= =?utf-8?q?_=C5=A0ipraga?= , Lino Sanfilippo Subject: [PATCH net 0/2] Fix mdiobus users with devres Date: Tue, 21 Sep 2021 00:42:07 +0300 Message-Id: <20210920214209.1733768-1-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: AM0PR04CA0092.eurprd04.prod.outlook.com (2603:10a6:208:be::33) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (82.78.148.104) by AM0PR04CA0092.eurprd04.prod.outlook.com (2603:10a6:208:be::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16 via Frontend Transport; Mon, 20 Sep 2021 21:42:38 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2a6495ca-6f64-4246-acd4-08d97c7f9186 X-MS-TrafficTypeDiagnostic: VI1PR04MB3198: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1227; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yaN5KlOrrTfB/2ARcudtkk+CdWm1u2kmyYfemccVYyt4IkYjHWZRBs7MAu/6+xjDph0p9VFEZOkMjhGvYB5SSfKPje0hXJcnfNCoqEUK66P1rtv/5cf5xF64hr4BCb4zCmfSmf3SPyPpsaPhAQEd19ZcMjqTT5YL9u7eIGyCwoBuHSe3OkL5Kx8QF5x9tntvYr6kESr49dAsNKMTBUbAP2CEnNZHrp+vhJ8qNF32Ore6Oitmq4lmPgPq16HJTiG2go2PN8KyiGYwABAhwiqNi/72uMMVGn7op6UdoTwzH2EiPM9XLzKthP0MhNEvpIOqltsoKkn9GvLWNAAsW052t5FE2M1WakSASzZl6kr4DzuUSlzwmgvIHylk4v0yxXyybPjCnvM5e603ByhlB6OvMBAAQ9E/TkloyMiSuJMH4IlTaZrIHjjCCDRbM8vkCW8eiZON3zT+cUc97HWccdPw3MWDwBR/dd/7h9UUSCxQj+DrHjxxyasxSJOXc/1VK/Ki1E07GN7DAAKupxfzoGwWVkHEYN8D61E0BCvu8do4Y3LorbDnUKtbSHg9pUwbEp+I8xxPg2qyunbTRmz3Fn7uOKjrxyS1NDpDGV0MuTLMh5f/J6bs7+wO4DDZ0ruugJSX+28j6iROZxXGPfbAzf9o7LoPNIUXt/f27/ndK64wL8Jwkv5wzqbZncqZxhuOjoxmlZVTR0GGeyD6WlfsDqo//g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(366004)(396003)(376002)(39860400002)(136003)(52116002)(38100700002)(38350700002)(4326008)(1076003)(44832011)(7416002)(83380400001)(66946007)(26005)(6486002)(8936002)(2616005)(8676002)(6512007)(6916009)(956004)(2906002)(478600001)(66476007)(66556008)(316002)(54906003)(36756003)(186003)(86362001)(6506007)(5660300002)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?v5GEB4bggJbzSYl1ou6ZmM8rgqRQ?= =?utf-8?q?5FcgLkAjAQtY/1UmiMgJj8VgBdm7mbG0fhhIfDMUO0SQet6TDqwGjuSxtJCCHqfPP?= =?utf-8?q?lyTOuLSEFLoYQGVOL149giED0LcywVJlnd9pL7kHypMLuRpctA0i8nSVdyIXZzjFK?= =?utf-8?q?hBnNBezk4s6uZ4f74vjjNCPRG3MgJxNFX0ZSCHAV8r+OHCSQFD1w4ygDm1+cyzRgD?= =?utf-8?q?Lz2l4d9upowUvoQtIluqj7yd6Uvr4XqLqbDAJFVr7KnV8l83qk5kyMAAxHXmQlYqx?= =?utf-8?q?8coWVcryDvTzPQe+ozQzLfDirQemoSQBF6N/gn6+filJrMCA4vogLhErI4A4cQdTt?= =?utf-8?q?2AOmDgsP5tRaneGCXny+IO3GI5R64mtfFGk2o65ee/9D9WerGaDzXGfQDhjTyzXzG?= =?utf-8?q?EzsGPe1RzOLfuQAhHfbDbXa9odKu/BJDRtSRvdXJOOU3uUUEAd7lIyY1Hg6SXlKiw?= =?utf-8?q?zfU9XEIvWqpDij+YN3hM521+0lOec5LaFwv2l9XekQBhGOom8PhW6ZasntZNjUcx7?= =?utf-8?q?fyPzR6CakI17y9VC1iQ4TJiSJb+dQJsG0+VA1BeNtsWcC4G+BHz+sCgcUQstunSfw?= =?utf-8?q?IxyDNoKJ2zNBSi/WhLzYY/ZzDe8HlMb0TRkbPOP9Ma/Uq5NBZSFQnQm5VVoYRqUez?= =?utf-8?q?/y2uwh2f3Liuz+3UOhd9YkGEtI9IcajAqtvznkRAP0qlU172Vr+VZlj1lKdfrJhqJ?= =?utf-8?q?Q56NuC6HOZ8rCEAo2v/t+IDfHpGSMlySfSzgUJ+8oYHisxdJ+ZaSE5dEuMmj+n7nL?= =?utf-8?q?DVmuTdJLptkdo7agmFQy7axYjobPL7DUvDtAUNwt8C1FjHeQt/CVZWUeYc9g3cZyi?= =?utf-8?q?fn40L+lf+yMdiRdBM/LXlR9rlYcmBY8mooSw9teYRtsFweTGlxzXR/EPNRGFd6mk6?= =?utf-8?q?zXUKnqYZZChMWOqgfAycuQ6LKonCAznS7r8RSWjOqnDxsup231+tAgb9SOC9TbOCm?= =?utf-8?q?u5MDZOb7ibyolKrOT65sWFDnb7dSkCqsLVgbt/PXntxFqPdij1hCuFsLfY/Xz9HbM?= =?utf-8?q?3DJVDyRkrjBDRQtCNpgDT9/KbFkDdagsAMnszRx/C7yXTdoqYeLtzCMCCoaX5gKpH?= =?utf-8?q?Sn/P8cE3gImYAFamsk45wvpWWQxSELbEECtIelF9hjM196ICmGQJ2yuBtrsYswXyW?= =?utf-8?q?rmWXLvBA17jf2gxdkSwKsi+iUuFain5RMFgOplDd2SLfGXoF6hEwesEnfaZ5VT7SD?= =?utf-8?q?fWcoTrNstKvxkQfDIREEE2+8XS92syPDqHAeGeH1h9E10FHiN9nPRpjvL5Gz6x64U?= =?utf-8?q?PrU4ngP4cNivhER1?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a6495ca-6f64-4246-acd4-08d97c7f9186 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2021 21:42:39.5707 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: q2ISgDibuRUFWa08UjJiu1lGjFgGnIeK0SlwpcAY2HfF/xe4qOZ7cPbsGduML7nTAXCyARO49aozlA92rgQzpg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB3198 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Commit ac3a68d56651 ("net: phy: don't abuse devres in devm_mdiobus_register()") by Bartosz Golaszewski has introduced two classes of potential bugs by making the devres callback of devm_mdiobus_alloc stop calling mdiobus_unregister. The exact buggy circumstances are presented in the individual commit messages. I have searched the tree for other occurrences, but at the moment: - for issue (a) I have no concrete proof that other buses except SPI and I2C suffer from it, and the only SPI or I2C device drivers that call of_mdiobus_alloc are the DSA drivers that leave a NULL ds->slave_mii_bus and a non-NULL ds->ops->phy_read, aka ksz9477, ksz8795, lan9303_i2c, vsc73xx-spi. - for issue (b), all drivers which call of_mdiobus_alloc either use of_mdiobus_register too, or call mdiobus_unregister sometime within the ->remove path. Although at this point I've seen enough strangeness caused by this "device_del during ->shutdown" that I'm just going to copy the SPI and I2C subsystem maintainers to this patch series, to get their feedback whether they've had reports about things like this before. I don't think other buses behave in this way, it forces SPI and I2C devices to have to protect themselves from a really strange set of issues. Vladimir Oltean (2): net: dsa: don't allocate the slave_mii_bus using devres net: dsa: realtek: register the MDIO bus under devres drivers/net/dsa/realtek-smi-core.c | 2 +- net/dsa/dsa2.c | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) Acked-by: Bartosz Golaszewski