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 C506F257854; Thu, 28 May 2026 20:21:59 +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=1779999720; cv=none; b=GHLyxiOlMuDokEkuxjOnGw1JODDaVlctKZSIcUgVOe5XV9Y3WC+05Uhz5lAX+zNLmNtzqT/GpOTG8rPWqmvgBYEvNUGWThjB5Mgo51wQ3A23AxtE7V2Dexlm3XHrNBxL2dajvH7dfryFB4kg6eQlLQJuPU6hfijSfxCVeMOuC2A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779999720; c=relaxed/simple; bh=wCYsYBOwt/TDJNC5dcXK0dxC2QbK+/XmxazPxqRBnJg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ao1OgMIGKwP68pVCBcLhU+F5TzWfIKAXA8Io/ILmTI2Xnm9OZEJjr/h8pgLCHPu5/V/AU8OIqNo9fUiEU9Ds4c0oULA2zcd6QWxHj6BiO9tAWdm/Qun5rzOtWU/aaaGDKNE4uAPRSa5T0hRN9jjzxM+m4vINct+ELW5ldJPLeZY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ryy9GAxb; 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="ryy9GAxb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 249591F000E9; Thu, 28 May 2026 20:21:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779999719; bh=4DnWEYNbwKhU6jI2M3bjPnVRZLl9gz+rb1es0AHmeXA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ryy9GAxbYblLDXDFIhDLGI9cXZLAfF81Zb795EG4J9jdpaQJ2xj/yfmPRMM+wpPWT yrmpVrsnx4UEDulMNCFUwUq3oDLXUp2RzO3oyaEKpBsbLMdm1GwVzUUNLJY30HHhKZ fihp9TZCZaHuD8JCiRNqVsy40YNS3vtoJFGLVPXY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Abdurrahman Hussain , Guenter Roeck Subject: [PATCH 6.18 168/377] hwmon: (pmbus/adm1266) register the nvmem device after pmbus_do_probe() Date: Thu, 28 May 2026 21:46:46 +0200 Message-ID: <20260528194643.292565151@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260528194638.371537336@linuxfoundation.org> References: <20260528194638.371537336@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-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 @@ -470,14 +470,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;