<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/acpi/device_sysfs.c, branch v6.1.168</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.168</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.168'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2024-10-17T13:21:21+00:00</updated>
<entry>
<title>ACPI: sysfs: validate return type of _STR method</title>
<updated>2024-10-17T13:21:21+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>linux@weissschuh.net</email>
</author>
<published>2024-07-09T20:37:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5c8d007c14aefc3f2ddf71e4c40713733dc827be'/>
<id>urn:sha1:5c8d007c14aefc3f2ddf71e4c40713733dc827be</id>
<content type='text'>
commit 4bb1e7d027413835b086aed35bc3f0713bc0f72b upstream.

Only buffer objects are valid return values of _STR.

If something else is returned description_show() will access invalid
memory.

Fixes: d1efe3c324ea ("ACPI: Add new sysfs interface to export device description")
Cc: All applicable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
Link: https://patch.msgid.link/20240709-acpi-sysfs-groups-v2-1-058ab0667fa8@weissschuh.net
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>ACPI: sysfs: Fix create_pnp_modalias() and create_of_modalias()</title>
<updated>2023-11-20T10:51:55+00:00</updated>
<author>
<name>Christophe JAILLET</name>
<email>christophe.jaillet@wanadoo.fr</email>
</author>
<published>2023-10-23T18:32:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=35aff5362693c63c8376db43d6c011caffe32161'/>
<id>urn:sha1:35aff5362693c63c8376db43d6c011caffe32161</id>
<content type='text'>
[ Upstream commit 48cf49d31994ff97b33c4044e618560ec84d35fb ]

snprintf() does not return negative values on error.

To know if the buffer was too small, the returned value needs to be
compared with the length of the passed buffer. If it is greater or
equal, the output has been truncated, so add checks for the truncation
to create_pnp_modalias() and create_of_modalias(). Also make them
return -ENOMEM in that case, as they already do that elsewhere.

Moreover, the remaining size of the buffer used by snprintf() needs to
be updated after the first write to avoid out-of-bounds access as
already done correctly in create_pnp_modalias(), but not in
create_of_modalias(), so change the latter accordingly.

Fixes: 8765c5ba1949 ("ACPI / scan: Rework modalias creation when "compatible" is present")
Signed-off-by: Christophe JAILLET &lt;christophe.jaillet@wanadoo.fr&gt;
[ rjw: Merge two patches into one, combine changelogs, add subject ]
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>ACPI: bus: Drop driver member of struct acpi_device</title>
<updated>2022-06-30T12:11:21+00:00</updated>
<author>
<name>Uwe Kleine-König</name>
<email>u.kleine-koenig@pengutronix.de</email>
</author>
<published>2022-06-18T11:23:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d6fb6ee1820cb9c49717b8d28c5b2e940cb2e439'/>
<id>urn:sha1:d6fb6ee1820cb9c49717b8d28c5b2e940cb2e439</id>
<content type='text'>
struct acpi_device::driver tracks the same information as the driver
member of struct acpi_device::dev.

Fix all users of the former to use the latter and drop the redundant
data from struct acpi_device.

Signed-off-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>ACPI: sysfs: use default_groups in kobj_type</title>
<updated>2021-12-28T18:15:41+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2021-12-28T13:14:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=17f18417d6da07bbaafce84f80fa25d860b6e6d1'/>
<id>urn:sha1:17f18417d6da07bbaafce84f80fa25d860b6e6d1</id>
<content type='text'>
There are currently 2 ways to create a set of sysfs files for a
kobj_type, through the default_attrs field, and the default_groups
field.  Move the ACPI sysfs code to use default_groups field which has
been the preferred way since aa30f47cf666 ("kobject: Add support for
default attribute groups to kobj_type") so that we can soon get rid of
the obsolete default_attrs field.

Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>ACPI: sysfs: fix doc warnings in device_sysfs.c</title>
<updated>2021-06-17T12:32:05+00:00</updated>
<author>
<name>Baokun Li</name>
<email>libaokun1@huawei.com</email>
</author>
<published>2021-06-15T07:19:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6f2f92c6ae4261c6c3dc00a0397f70fa0ac267fb'/>
<id>urn:sha1:6f2f92c6ae4261c6c3dc00a0397f70fa0ac267fb</id>
<content type='text'>
Fixes the following W=1 kernel build warning(s):

 drivers/acpi/device_sysfs.c:278: warning: Function parameter or
  member 'dev' not described in 'acpi_device_uevent_modalias'
 drivers/acpi/device_sysfs.c:278: warning: Function parameter or
  member 'env' not described in 'acpi_device_uevent_modalias'
 drivers/acpi/device_sysfs.c:323: warning: Function parameter or
  member 'dev' not described in 'acpi_device_modalias'
 drivers/acpi/device_sysfs.c:323: warning: Function parameter or
  member 'buf' not described in 'acpi_device_modalias'
 drivers/acpi/device_sysfs.c:323: warning: Function parameter or
  member 'size' not described in 'acpi_device_modalias'

Signed-off-by: Baokun Li &lt;libaokun1@huawei.com&gt;
[ rjw: Fix spelling: acpi -&gt; ACPI ]
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>ACPI: sysfs: Fix a buffer overrun problem with description_show()</title>
<updated>2021-06-07T14:27:44+00:00</updated>
<author>
<name>Krzysztof Wilczyński</name>
<email>kw@linux.com</email>
</author>
<published>2021-06-03T17:12:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=888be6067b97132c3992866bbcf647572253ab3f'/>
<id>urn:sha1:888be6067b97132c3992866bbcf647572253ab3f</id>
<content type='text'>
Currently, a device description can be obtained using ACPI, if the _STR
method exists for a particular device, and then exposed to the userspace
via a sysfs object as a string value.

If the _STR method is available for a given device then the data
(usually a Unicode string) is read and stored in a buffer (of the
ACPI_TYPE_BUFFER type) with a pointer to said buffer cached in the
struct acpi_device_pnp for later access.

The description_show() function is responsible for exposing the device
description to the userspace via a corresponding sysfs object and
internally calls the utf16s_to_utf8s() function with a pointer to the
buffer that contains the Unicode string so that it can be converted from
UTF16 encoding to UTF8 and thus allowing for the value to be safely
stored and later displayed.

When invoking the utf16s_to_utf8s() function, the description_show()
function also sets a limit of the data that can be saved into a provided
buffer as a result of the character conversion to be a total of
PAGE_SIZE, and upon completion, the utf16s_to_utf8s() function returns
an integer value denoting the number of bytes that have been written
into the provided buffer.

Following the execution of the utf16s_to_utf8s() a newline character
will be added at the end of the resulting buffer so that when the value
is read in the userspace through the sysfs object then it would include
newline making it more accessible when working with the sysfs file
system in the shell, etc.  Normally, this wouldn't be a problem, but if
the function utf16s_to_utf8s() happens to return the number of bytes
written to be precisely PAGE_SIZE, then we would overrun the buffer and
write the newline character outside the allotted space which can have
undefined consequences or result in a failure.

To fix this buffer overrun, ensure that there always is enough space
left for the newline character to be safely appended.

Fixes: d1efe3c324ea ("ACPI: Add new sysfs interface to export device description")
Signed-off-by: Krzysztof Wilczyński &lt;kw@linux.com&gt;
Reviewed-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'acpi-misc'</title>
<updated>2021-04-26T15:04:41+00:00</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2021-04-26T15:04:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b6237f61fc9ca79b8771a4fa412d2c630c9f8d2b'/>
<id>urn:sha1:b6237f61fc9ca79b8771a4fa412d2c630c9f8d2b</id>
<content type='text'>
* acpi-misc:
  ACPI: dock: fix some coding style issues
  ACPI: sysfs: fix some coding style issues
  ACPI: PM: add a missed blank line after declarations
  ACPI: custom_method: fix a coding style issue
  ACPI: CPPC: fix some coding style issues
  ACPI: button: fix some coding style issues
  ACPI: battery: fix some coding style issues
  ACPI: acpi_pad: add a missed blank line after declarations
  ACPI: LPSS: add a missed blank line after declarations
  ACPI: ipmi: remove useless return statement for void function
  ACPI: processor: fix some coding style issues
  ACPI: APD: fix a block comment align issue
  ACPI: AC: fix some coding style issues
  ACPI: fix various typos in comments
</content>
</entry>
<entry>
<title>ACPI: bus: Introduce acpi_dev_get() and reuse it in ACPI code</title>
<updated>2021-04-13T13:41:11+00:00</updated>
<author>
<name>Andy Shevchenko</name>
<email>andy.shevchenko@gmail.com</email>
</author>
<published>2021-04-12T22:23:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4cbaba4e3e4a8a00ed90193ae519c52ba01ea756'/>
<id>urn:sha1:4cbaba4e3e4a8a00ed90193ae519c52ba01ea756</id>
<content type='text'>
Introduce acpi_dev_get() to have a symmetrical API with acpi_dev_put()
and reuse both in ACPI code in drivers/acpi/.

While at it, use acpi_bus_put_acpi_device() in one place instead of
the above.

Signed-off-by: Andy Shevchenko &lt;andy.shevchenko@gmail.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>ACPI: sysfs: fix some coding style issues</title>
<updated>2021-04-08T14:27:02+00:00</updated>
<author>
<name>Xiaofei Tan</name>
<email>tanxiaofei@huawei.com</email>
</author>
<published>2021-03-27T12:08:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d0fb66e999ffafe425833b8bdfcaabb3d7941c93'/>
<id>urn:sha1:d0fb66e999ffafe425833b8bdfcaabb3d7941c93</id>
<content type='text'>
Fix some coding style issues reported by checkpatch.pl, including
following types:

WARNING: Missing a blank line after declarations
WARNING: Block comments should align the * on each line
ERROR: open brace '{' following function definitions go on the next line

Signed-off-by: Xiaofei Tan &lt;tanxiaofei@huawei.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>Merge branches 'acpi-misc', 'acpi-cppc', 'acpi-docs', 'acpi-config' and 'acpi-apei'</title>
<updated>2021-02-15T16:04:40+00:00</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2021-02-15T16:04:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6e60afb22c08f46a24cbfbd96bac4af593d579f8'/>
<id>urn:sha1:6e60afb22c08f46a24cbfbd96bac4af593d579f8</id>
<content type='text'>
* acpi-misc:
  ACPI: Test for ACPI_SUCCESS rather than !ACPI_FAILURE
  ACPI: Use DEVICE_ATTR_&lt;RW|RO|WO&gt; macros

* acpi-cppc:
  ACPI: CPPC: initialise vaddr pointers to NULL
  ACPI: CPPC: add __iomem annotation to generic_comm_base pointer
  ACPI: CPPC: remove __iomem annotation for cpc_reg's address

* acpi-docs:
  Documentation: ACPI: add new rule for gpio-line-names

* acpi-config:
  ACPI: configfs: add missing check after configfs_register_default_group()

* acpi-apei:
  ACPI: APEI: ERST: remove unneeded semicolon
  ACPI: APEI: Add is_generic_error() to identify GHES sources
</content>
</entry>
</feed>
