Article View: linux.kernel.netdev
Article #20658Re: [PATCH] net: dsa: mt7530: fix regulator leak in mt7530_setup()
From: Xiangwu Lai
Date: Mon, 23 Nov 2026 02:30
Date: Mon, 23 Nov 2026 02:30
50 lines
10751 bytes
10751 bytes
Hi, On Sun, 22 Nov 2026 02:06:20 +0000, netdev-bot+sashiko wrote: > Thank you for your contribution! Sashiko AI review found 3 potential > issue(s) to consider. > > - [High] The fix is incomplete. > - [Medium] The new err_powers/err_disable_core_pwr paths in > mt7530_setup() disable core_pwr/io_pwr, but mt7530_remove() was not??> - [Low] This is speculative and depends on the hardware. Thanks for the review, I verified all three findings against the code and agree with them: * High: Correct. The v2 error paths only covered mt7530_setup() itself, while mt7530_setup_irq(), mt7530_setup_mdio() (both can also return -EPROBE_DEFER), the SGMII PCS creation and the DSA core setup steps can all fail afterwards with the regulators left enabled, so the fix was indeed incomplete. * Medium: Correct. In a multi-switch tree a switch can bind while its ds->ops->setup has not run yet, and a later failing setup of that switch is reported through the other switch's probe. The v2 unwinding would then have left the bound switch with an unbalanced regulator_disable() in mt7530_remove(). * Low: Point taken. It is speculative for a software-only fix, and mt7530_remove() already disables the regulators in the same order. I have posted a v3 that adopts the ownership suggestion from the review instead of unwinding manually: [PATCH v3] net: dsa: mt7530: manage the core and io regulators with devm actions https://lore.kernel.org/r/20261123022415.433-1-laixiangwu@cmss.chinamobile.com The enables now live in mt7530_probe(), each paired with a devm_add_action_or_reset() that disables the regulator again, and the explicit disables in mt7530_remove() are gone. This covers every error path after the enables and keeps the enables and disables balanced in all combinations of probe, setup and unbind. For reference, the earlier versions of this fix: v1: https://lore.kernel.org/r/20261118014114.1855-1-laixiangwu@cmss.chinamobile.com v2: https://lore.kernel.org/r/20261119060424.1476-1-laixiangwu@cmss.chinamobile.com pw-bot: cr Best regards, Xiangwu Lai
Technical Details
Message-ID:
<20261123023041.609-1-laixiangwu@cmss.chinamobile.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368962-linux-kernel-netdev=dewy.ruReferences:
<179531318026.3135.909782780821579093@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368962-linux-kernel-netdev=dewy.ru From: laixiangwu@cmss.chinamobile.com (Xiangwu Lai) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH] net: dsa: mt7530: fix regulator leak in mt7530_setup() Date: Mon, 23 Nov 2026 10:30:41 +0800 Organization: Usenet Network Message-ID: <20261123023041.609-1-laixiangwu@cmss.chinamobile.com> References: <179531318026.3135.909782780821579093@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3772234"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:GYPpFOEn6q9egey1SyTHG+xblPs= sha256:quosnW207CDiifrJ+VVuP7goSjKg9W8G6axmp3QvFMs= sha1:sLiVmhwDbYPq/uOK3cVpxMOH1UQ= sha256:TSs+1zOhLft5kgyv1oEZKKSZ9TeSQSPrOfFwADf+cQ8= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 16B38125D8C; Mon, 23 Nov 2026 05:31:02 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.75 X-Spam-Status: No, score=-2.75 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=fail (1024-bit key) reason="fail (body has been altered)" header.d=cmss.chinamobile.com X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pD3I6OYzlxzl; Mon, 23 Nov 2026 05:30:57 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-368962-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=cmss.chinamobile.com X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 30220125D83; Mon, 23 Nov 2026 05:30:49 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 5AAE726B1C; Mon, 23 Nov 2026 02:30:46 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795401045; b=FBBVQMBzFQsAOMGhWT+jOmrWyvzfvzFXmQcIasspQ/gUUYuEKz457Gd8BwqlsBDXbfno l8SM4bo9jeuYpf7rcf9oFHRu0pPIQ2oyRpNJusVkTsIHGzM7CZZYn/WPsDxsSF7a9dlQ4 OY77PNiwrH/Qse9ocDqjW4VMRxF1iQbwpiAYye6W4vpovtGI5/0I4Fy5ei3LlUIkyDhna ZTm+iF+rmmDjj5wjUnU6fLhtoeG7eykjeuvVNIiQrMws494notuKsN2GyZxWUqdEyYKsk fG0HJd7HMYrD6/rICbO49yT4JH5NAFVIl8J9dyPp4497QH0hK9I4nnSGtEjxnIOd4nw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795401045; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:X-RM-TagInfo: X-RM-SPAM-FLAG:Received:X-RM-TRANSID:X-RM-TagInfo:X-RM-SPAM-FLAG: Received:X-RM-TRANSID:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-Mailing-List:List-Id:List-Post:List-Help: List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding; bh=Cq/cYX7/b8Dzuiz6ClHov3WU2VvNwLYaxpdD04so0IE=; b=K1CncjnkTjjl3tsJRx6ZckBNT8AVbZwBXscrs5Lb6fIOQsX3UsChaviLVPq9Mv8zdm0T SsTOv8V55AkW8JW2TqgFgQoDzAEJXqzgO5LLeuYlDf2B2sGmgO0sr0eblWQaHUNSvmnIf kLqP7+jSvaybm2sh8pbc4sgeO6hsi3TzZ1Bi5ZeUUaJl2uKtiv1qq1ZIBOc+0x5rkCe8d Ykq1gLZgXFHJlvJHIe1ZIG5fldjEKmlq3e8BaGfl0BF3hQusY5lC9v/D+1+9St9yxnHuW zh6V8ahyGhLDF9eQmzJaG7gqD5+Ejx7x7JONJf9WetFYX8Vk2MAtlgZxZHrxOvKZDdw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b="ap/m1zbY"; dmarc=pass header.from=cmss.chinamobile.com; spf=pass smtp.mailfrom=cmss.chinamobile.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE651606A33D; Mon, 23 Nov 2026 02:30:44 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b=ap/m1zbY X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=111.22.67.137 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795401044; b=ukfEwKOz+iaF1p3qNHDn0fFn+nmTjKV6gxswna+fB4aef1ZTiPPNYP0Lwr8ZEkkfaTT6 p/eaAzvxHOPW3eTlqY/1qAMSn2mCKMhWYkmZpkblWWAOHZZtA34ZOm+Je4t2SzKBcq317 SoDHqYjn4VQY3g+92q/IRRPJUh9UU3eB45Cly04Z2CItYn3bvzoK2zjHcY0rS80+5PMP/ Y+avujNIVp7NGxNAzf7292G6MM1kLdqpuAjDC6feKVq9tHcCj4mrhlcmGRsxkHmp7xDXm ofoPuxOV/cZfUXZwJ6sWwLioHxTkbHmSWn3bCPi8Hi3aNkli9t2T8sGRDWPruOql5/A== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795401044; h=DMARC-Filter:DKIM-Signature:X-RM-TagInfo:X-RM-SPAM-FLAG:Received: X-RM-TRANSID:X-RM-TagInfo:X-RM-SPAM-FLAG:Received:X-RM-TRANSID:From: To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=Cq/cYX7/b8Dzuiz6ClHov3WU2VvNwLYaxpdD04so0IE=; b=vZ7Fme7ofTGhpWHsRWLGASsEC+ElB4Pmvcp2lQpFMThjajXMgyLLejquDMgwXFDTe1nl bkYUMt8i8pF5yCvkp6PK4/ASuRIF0c9JDb4pL2+63MTYXv5yDHsTrU0z5pxhUQsAXafNK 3xLknxaqmWUldeF61uJlm20OmkAhosz0lM/JMzOpzMM2pUaeu/zjO3hdn07weHaYNW+pn pPU9EJNxpondM9iy9VpL65yacaVA+q5BtVxI+dnN5P1imvK/+/CdJZpmMnCG7u6oUq7uo UDWpACYyx6DIqdkyr2ArMMgrQXGkRatfTOW45pkJD/IxBXvjND1M47MfgupTKYNYrcA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=cmss.chinamobile.com; spf=pass smtp.mailfrom=cmss.chinamobile.com; dkim=pass header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b="ap/m1zbY"; arc=none smtp.remote-ip=111.22.67.137 X-Received: from cmccmta4.chinamobile.com (cmccmta4.chinamobile.com [111.22.67.137]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 05D7A606A31E; Mon, 23 Nov 2026 02:30:42 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 05D7A606A31E X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmss.chinamobile.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmss.chinamobile.com X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmss.chinamobile.com; s=default; l=0; h=from:subject:message-id:to:cc:mime-version; bh=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=; b=ap/m1zbYYyigZzmloFF1/kMe45Uwudj+XEMEQDffMpBkOcCeebRzKl75HJ7IV3EWn10AteMNIu13P rXRiQiRnNIN0WVk5MEvkOA8nVdCkHLF/EJkotgDpYOmTMSESdVZEFjuROg7O8OcFyHtYYW6jj9l0r8 bcI/T8hj/h4Rwx2U= X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 X-Received: from spf.mail.chinamobile.com (unknown[10.188.0.87]) by rmmx-syy-dmz-app04-12004 (RichMail) with SMTP id 2ee46b03a54e409-d7b05; Mon, 23 Nov 2026 10:30:41 +0800 (CST) X-RM-TRANSID: 2ee46b03a54e409-d7b05 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 X-Received: from DESKTOP-3K8GUTQ (unknown[223.108.79.98]) by rmsmtp-syy-appsvr02-12002 (RichMail) with SMTP id 2ee26b03a54f965-83027; Mon, 23 Nov 2026 10:30:41 +0800 (CST) X-RM-TRANSID: 2ee26b03a54f965-83027 X-Cc: Xiangwu Lai <laixiangwu@cmss.chinamobile.com>, chester.a.unal@arinc9.com, daniel@makrotopia.org, andrew@lunn.ch, olteanv@gmail.com, sean.wang@mediatek.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kuba@kernel.org X-Mailer: git-send-email 2.50.1.windows.1 X-In-Reply-To: <179531318026.3135.909782780821579093@kernel.org> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list