From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 2E53A34B40F; Sat, 30 May 2026 17:32:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780162358; cv=none; b=HkrHUc7N16f5CBp4NZqORdMADSb9Gi6w6rAQyl//ZQYYq7Mpsz094ByEpzw2rp+cmGpMbYmw6nNSJv7piS3eP+3UADDDJPw67a3SEZPPS0Zq00FkLXqooCsHMashlWZU0AryySFWAeaWAMA2l/TnB+zGuTBgFreii7QUMUc8IXc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780162358; c=relaxed/simple; bh=9Zwr8iFIzSmAcaOjw098TdXL4W//+D80sH7x7onOMEw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V0Yn/nhg9Sm7jYO345hc070G7WIhc1fDtWsWc6H02/11sQWR5v9McaspZYMExAeKkRTpomji5b3RRQUSCYh+pYn/tqmrZtH5v4d2+XlwRFnq2b4EhZy9CH6vjjmkctGQqLdjRNe43xElL56af46Vf1/AAYZ3Ani97fSMjuZSOCI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=v3i2bRmm; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="v3i2bRmm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65A711F00893; Sat, 30 May 2026 17:32:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780162356; bh=2yqYNMLF21exhB9IpC+DUlXRoyQn8gasBp0oDmFs6r0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=v3i2bRmm5MgcpFj9knfkkVoUhCM5384cHSvikSpNq/D7ZBRZ34ctdd0o1u0yiBwuJ qJptXpxqFgBbAy2SQMukrRPoZ0ClZiEFGhh+1c5401BQChDySWGL60iIxwcVP8ZrX9 z/O4ba8qy1/2ZpkiCzzw5W0kBWrVuiCMS8AJEn2c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Abdurrahman Hussain , Bartosz Golaszewski , Guenter Roeck Subject: [PATCH 6.1 896/969] hwmon: (pmbus/adm1266) register the gpio_chip after pmbus_do_probe() Date: Sat, 30 May 2026 18:07:00 +0200 Message-ID: <20260530160325.449859080@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160300.485627683@linuxfoundation.org> References: <20260530160300.485627683@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Abdurrahman Hussain commit 491403b9b76cf66abd81301c5901aa4a4549f1e8 upstream. adm1266_probe() calls adm1266_config_gpio() -- which goes on to devm_gpiochip_add_data() and exposes the gpio_chip callbacks to gpiolib -- before pmbus_do_probe() has initialised the per-client PMBus state (notably the pmbus_lock mutex the core hands out via pmbus_get_data()). That ordering is already a latent hazard: any GPIO access that lands between adm1266_config_gpio() and the end of pmbus_do_probe() (for example a sysfs read from a user space agent that opens the gpiochip the instant gpiolib advertises it) races pmbus_do_probe()'s own device accesses with no serialisation. Move adm1266_config_gpio() down past pmbus_do_probe() so the chip isn't reachable from userspace until the PMBus state it depends on is fully initialised. Fixes: d98dfad35c38 ("hwmon: (pmbus/adm1266) Add support for GPIOs") Cc: stable@vger.kernel.org Signed-off-by: Abdurrahman Hussain Reviewed-by: Bartosz Golaszewski Link: https://lore.kernel.org/r/20260518-adm1266-gpio-fixes-v3-4-e425e4f88139@nexthop.ai Signed-off-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/pmbus/adm1266.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/hwmon/pmbus/adm1266.c +++ b/drivers/hwmon/pmbus/adm1266.c @@ -468,10 +468,6 @@ static int adm1266_probe(struct i2c_clie crc8_populate_msb(pmbus_crc_table, 0x7); mutex_init(&data->buf_mutex); - ret = adm1266_config_gpio(data); - if (ret < 0) - return ret; - ret = adm1266_set_rtc(data); if (ret < 0) return ret; @@ -484,6 +480,10 @@ static int adm1266_probe(struct i2c_clie if (ret) return ret; + ret = adm1266_config_gpio(data); + if (ret < 0) + return ret; + adm1266_init_debugfs(data); return 0;