]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
platform/x86: dell-smbios: Fix wrong token data in sysfs
authorArmin Wolf <W_Armin@gmx.de>
Tue, 28 May 2024 20:49:02 +0000 (22:49 +0200)
committerRoxana Nicolescu <roxana.nicolescu@canonical.com>
Fri, 2 Aug 2024 14:26:52 +0000 (16:26 +0200)
commita509e981f3b4d10f8a01c7bab51bfff967127523
tree81e7f2f13f0a5de938b3bfec08c134613590b667
parentbc5216748025ef18003b4d5e424e78a9af306eb3
platform/x86: dell-smbios: Fix wrong token data in sysfs

BugLink: https://bugs.launchpad.net/bugs/2074091
[ Upstream commit 1981b296f858010eae409548fd297659b2cc570e ]

When reading token data from sysfs on my Inspiron 3505, the token
locations and values are wrong. This happens because match_attribute()
blindly assumes that all entries in da_tokens have an associated
entry in token_attrs.

This however is not true as soon as da_tokens[] contains zeroed
token entries. Those entries are being skipped when initialising
token_attrs, breaking the core assumption of match_attribute().

Fix this by defining an extra struct for each pair of token attributes
and use container_of() to retrieve token information.

Tested on a Dell Inspiron 3050.

Fixes: 33b9ca1e53b4 ("platform/x86: dell-smbios: Add a sysfs interface for SMBIOS tokens")
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20240528204903.445546-1-W_Armin@gmx.de
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Portia Stephens <portia.stephens@canonical.com>
Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
drivers/platform/x86/dell/dell-smbios-base.c