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 D82732E7379; Sat, 30 May 2026 17:32:42 +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=1780162363; cv=none; b=phz/hI0hWXQEUmpalf1P18h0cECQoTcDvy+NX+QiZNzeg3SbZb5pehfdizSUUcOYIKULJchE22jHlHv0MlxfSpnLWX+pCt3Hq+YgUhSa4UH2P7U/f+qpW9hZum8KLgyfLxyNSiX0iZeNg0y7k5rjNXSoeuc/P+MHcR310TYbaeQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780162363; c=relaxed/simple; bh=Gg2v05oG4ncMhXt/+hZy1MuYZLjzy1tADmRQ43febT0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EFKyjd/XpC1HrKRdeZzjmJDkwSijiyLCe/1Z2R0/Yq5CJOJ/dmT3iEFK0ZN/jvOYnkHAdmlzuumW1u1NxRe2l+jKLBfbt+tmTMldR6td9j6d10bwxltQ8COKALSvIvlGfm18C//oExnmTIOiJCvRqXmZ7a2zRFCiGzvdMINI4AI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lvVbp5Pv; 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="lvVbp5Pv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A95C1F00893; Sat, 30 May 2026 17:32:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780162362; bh=YP9IzbTG2ZcMSfS/JXs9t15tadv5Krzj8K83IAw97EM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lvVbp5Pvjm1uw0C+p8686I8UnbcJo5tNCLdZt0gDPGl5g5E3EvUha6JGmC2P8xWW4 9Dwwij/zmx5TtbYX+mRd92ANNqOzuGQiAX+NvWJqANZVSVtEc7RogYEKA/+8NYQcbZ nP1CYE1yXkdULZGp8/+bDjEbw2FwQ+AFD9p+lDNo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Abdurrahman Hussain , Guenter Roeck Subject: [PATCH 6.1 897/969] hwmon: (pmbus/adm1266) register the nvmem device after pmbus_do_probe() Date: Sat, 30 May 2026 18:07:01 +0200 Message-ID: <20260530160325.477378362@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 6af713af91d5c34ec049eb3cc2c5b3f5eba953b8 upstream. adm1266_probe() calls adm1266_config_nvmem() -- which goes on to devm_nvmem_register() and exposes adm1266_nvmem_read() to userspace -- before pmbus_do_probe() has initialised the per-client PMBus state. Same latent hazard as the gpio_chip one fixed in the previous patch: once the nvmem device is registered, gpiolib's nvmem char-dev / sysfs interface is reachable, and any concurrent read triggers adm1266_nvmem_read() -> adm1266_nvmem_read_blackbox(), which issues PMBus traffic that races pmbus_do_probe()'s own device accesses with no serialisation. Move adm1266_config_nvmem() down past pmbus_do_probe() so the nvmem device isn't reachable from userspace until the PMBus state the nvmem accessors depend on is fully initialised. Fixes: 15609d189302 ("hwmon: (pmbus/adm1266) read blackbox") Cc: stable@vger.kernel.org Signed-off-by: Abdurrahman Hussain Link: https://lore.kernel.org/r/20260518-adm1266-gpio-fixes-v3-5-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 @@ -472,14 +472,14 @@ static int adm1266_probe(struct i2c_clie if (ret < 0) return ret; - ret = adm1266_config_nvmem(data); - if (ret < 0) - return ret; - ret = pmbus_do_probe(client, &data->info); if (ret) return ret; + ret = adm1266_config_nvmem(data); + if (ret < 0) + return ret; + ret = adm1266_config_gpio(data); if (ret < 0) return ret;