tmp_suning_uos_patched/drivers/acpi/acpica
Hans de Goede ae6b3e54aa ACPICA: Fix handling of buffer-size in acpi_ex_write_data_to_field()
Generic Serial Bus transfers use a data struct like this:

struct gsb_buffer {
        u8      status;
        u8      len;
        u8      data[0];
};

acpi_ex_write_data_to_field() copies the data which is to be written from
the source-buffer to a temp-buffer. This is done because the OpReg-handler
overwrites the status field and some transfers do a write + read-back.

Commit f99b89eefe ("ACPICA: Update for generic_serial_bus and
attrib_raw_process_bytes protocol") acpi_ex_write_data_to_field()
introduces a number of problems with this:

 1) It drops a "length += 2" statement used to calculate the temp-buffer
 size causing the temp-buffer to only be 1/2 bytes large for byte/word
 transfers while it should be 3/4 bytes (taking the status and len field
 into account). This is already fixed in commit e324e10109 ("ACPICA:
 Update for field unit access") which refactors the code.

The ACPI 6.0 spec (ACPI_6.0.pdf) "5.5.2.4.5.2 Declaring and Using a
GenericSerialBusData Buffer" (page 232) states that the GenericSerialBus
Data Buffer Length field is only valid when doing a Read/Write Block
(AttribBlock) transfer, but since the troublesome commit we unconditionally
use the len field to determine how much data to copy from the source-buffer
into the temp-buffer passed to the OpRegion.

This causes 3 further issues:

 2) This may lead to not copying enough data to the temp-buffer causing the
 OpRegion handler for the serial-bus to write garbage to the hardware.

 3) The temp-buffer passed to the OpRegion is allocated to the size
 returned by acpi_ex_get_serial_access_length(), which may be as little
 as 1, so potentially this may lead to a write overflow of the temp-buffer.

 4) Commit e324e10109 ("ACPICA: Update for field unit access") drops a
 length check on the source-buffer, leading to a potential read overflow
 of the source-buffer.

This commit fixes all 3 remaining issues by not looking at the len field at
all (the interpretation of this field is left up to the OpRegion handler),
and copying the minimum of the source- and temp-buffer sizes from the
source-buffer to the temp-buffer.

This fixes e.g. an Acer S1003 no longer booting since the troublesome
commit.

Fixes: f99b89eefe (ACPICA: Update for generic_serial_bus and ...)
Fixes: e324e10109 (ACPICA: Update for field unit access)
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2018-11-19 11:06:09 +01:00
..
acapps.h ACPICA: iASL: Enhance the -tc option (create AML hex file in C) 2018-05-15 10:16:10 +02:00
accommon.h ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
acconvert.h ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
acdebug.h ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
acdispat.h ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
acevents.h ACPICA: Never run _REG on system_memory and system_IO 2018-10-04 09:06:27 +02:00
acglobal.h ACPICA: Convert acpi_gbl_hardware lock back to an acpi_raw_spinlock 2018-05-10 17:18:45 +02:00
achware.h ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
acinterp.h ACPICA: Split large interpreter file 2018-10-04 09:06:27 +02:00
aclocal.h ACPICA: Never run _REG on system_memory and system_IO 2018-10-04 09:06:27 +02:00
acmacros.h ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
acnamesp.h ACPICA: acpi_exec: fixing -fi option 2018-08-14 23:49:13 +02:00
acobject.h ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
acopcode.h ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
acparser.h ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
acpredef.h ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
acresrc.h ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
acstruct.h ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
actables.h ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
acutils.h ACPICA: Utilities: split hex detection into smaller functions 2018-08-14 23:49:13 +02:00
amlcode.h ACPICA: Rename some of the Field Attribute defines 2018-10-04 09:06:27 +02:00
amlresrc.h ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
dbcmds.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
dbconvert.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
dbdisply.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
dbexec.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
dbfileio.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
dbhistry.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
dbinput.c ACPICA: Debugger: Cleanup interface to the AML disassembler 2018-08-14 23:49:13 +02:00
dbmethod.c ACPICA: Debugger: Cleanup interface to the AML disassembler 2018-08-14 23:49:13 +02:00
dbnames.c ACPICA: Debugger: Add count of namespace nodes after namespace dump 2018-06-06 08:53:42 +02:00
dbobject.c ACPICA: Debugger: Reduce verbosity for module-level code errors. 2018-06-06 08:53:42 +02:00
dbstats.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
dbtest.c ACPICA: Debugger: Removed direct support for EC address space in "Test Objects" 2018-05-15 10:16:10 +02:00
dbutils.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
dbxface.c ACPICA: Debugger: Cleanup interface to the AML disassembler 2018-08-14 23:49:13 +02:00
dsargs.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
dscontrol.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
dsdebug.c ACPICA: Debugger: Reduce verbosity for module-level code errors. 2018-06-06 08:53:42 +02:00
dsfield.c ACPICA: acpiexec: fix a small memory leak regression 2018-08-14 23:49:13 +02:00
dsinit.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
dsmethod.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
dsmthdat.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
dsobject.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
dsopcode.c ACPICA: AML interpreter: add region addresses in global list during initialization 2018-10-18 09:17:04 +02:00
dspkginit.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
dsutils.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
dswexec.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
dswload.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
dswload2.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
dswscope.c ACPICA: Improve error messages for the namespace root node 2018-05-15 10:16:10 +02:00
dswstate.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
evevent.c ACPICA: Events: add a return on failure from acpi_hw_register_read 2018-03-18 19:29:46 +01:00
evglock.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
evgpe.c ACPICA: Introduce acpi_dispatch_gpe() 2018-05-25 10:30:35 +02:00
evgpeblk.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
evgpeinit.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
evgpeutil.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
evhandler.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
evmisc.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
evregion.c ACPICA: Never run _REG on system_memory and system_IO 2018-10-04 09:06:27 +02:00
evrgnini.c ACPICA: Never run _REG on system_memory and system_IO 2018-10-04 09:06:27 +02:00
evsci.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
evxface.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
evxfevnt.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
evxfgpe.c ACPICA: Introduce acpi_dispatch_gpe() 2018-05-25 10:30:35 +02:00
evxfregn.c ACPICA: Never run _REG on system_memory and system_IO 2018-10-04 09:06:27 +02:00
exconcat.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
exconfig.c ACPICA: Interpreter: Begin deprecation of Unload operator 2018-06-06 08:53:43 +02:00
exconvrt.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
excreate.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
exdebug.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
exdump.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
exfield.c ACPICA: Split large interpreter file 2018-10-04 09:06:27 +02:00
exfldio.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
exmisc.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
exmutex.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
exnames.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
exoparg1.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
exoparg2.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
exoparg3.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
exoparg6.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
exprep.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
exregion.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
exresnte.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
exresolv.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
exresop.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
exserial.c ACPICA: Fix handling of buffer-size in acpi_ex_write_data_to_field() 2018-11-19 11:06:09 +01:00
exstore.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
exstoren.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
exstorob.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
exsystem.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
extrace.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
exutils.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
hwacpi.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
hwesleep.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
hwgpe.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
hwpci.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
hwregs.c ACPICA: ACPICA: add status check for acpi_hw_read before assigning return value 2018-08-14 23:49:13 +02:00
hwsleep.c ACPICA: Clear status of all events when entering sleep states 2018-08-14 23:52:28 +02:00
hwtimer.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
hwvalid.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
hwxface.c ACPICA: Convert acpi_gbl_hardware lock back to an acpi_raw_spinlock 2018-05-10 17:18:45 +02:00
hwxfsleep.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
Makefile ACPICA: Split large interpreter file 2018-10-04 09:06:27 +02:00
nsaccess.c ACPICA: acpi_exec: fixing -fi option 2018-08-14 23:49:13 +02:00
nsalloc.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
nsarguments.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
nsconvert.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
nsdump.c ACPICA: Debugger: Add count of namespace nodes after namespace dump 2018-06-06 08:53:42 +02:00
nsdumpdv.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
nseval.c ACPICA: Cleanup/simplify module-level code support 2018-03-18 19:29:46 +01:00
nsinit.c ACPICA: Add deferred package support for the Load and loadTable operators 2018-05-14 22:25:45 +02:00
nsload.c ACPICA: Cleanup/simplify module-level code support 2018-03-18 19:29:46 +01:00
nsnames.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
nsobject.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
nsparse.c ACPICA: Cleanup/simplify module-level code support 2018-03-18 19:29:46 +01:00
nspredef.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
nsprepkg.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
nsrepair.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
nsrepair2.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
nssearch.c ACPICA: Revert "iASL: change processing of external op namespace nodes for correctness" 2018-07-09 11:14:45 +02:00
nsutils.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
nswalk.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
nsxfeval.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
nsxfname.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
nsxfobj.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
psargs.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
psloop.c ACPICA: Remove acpi_gbl_group_module_level_code and only use acpi_gbl_execute_tables_as_methods instead 2018-10-18 09:17:04 +02:00
psobject.c ACPICA: AML parser: attempt to continue loading table after error 2018-06-06 08:53:43 +02:00
psopcode.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
psopinfo.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
psparse.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
psscope.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
pstree.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
psutils.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
pswalk.c ACPICA: AML Parser: Add debug option to dump parse trees 2018-06-06 08:53:42 +02:00
psxface.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
rsaddr.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
rscalc.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
rscreate.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
rsdump.c ACPICA: Fix potential infinite loop in acpi_rs_dump_byte_list 2018-05-15 10:16:10 +02:00
rsdumpinfo.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
rsinfo.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
rsio.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
rsirq.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
rslist.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
rsmemory.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
rsmisc.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
rsserial.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
rsutils.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
rsxface.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
tbdata.c ACPICA: Update an error message for a duplicate table 2018-08-14 23:49:13 +02:00
tbfadt.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
tbfind.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
tbinstal.c ACPICA: Tables: Fix spelling mistake in comment 2018-05-15 10:16:10 +02:00
tbprint.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
tbutils.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
tbxface.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
tbxfload.c ACPICA: Remove acpi_gbl_group_module_level_code and only use acpi_gbl_execute_tables_as_methods instead 2018-10-18 09:17:04 +02:00
tbxfroot.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utaddress.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utalloc.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utascii.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utbuffer.c ACPICA: acpidump/acpixtract: Support for tables larger than 1MB 2018-05-18 09:19:26 +02:00
utcache.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utcopy.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utdebug.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utdecode.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utdelete.c ACPICA: Reference count: add additional debugging details 2018-08-14 23:49:13 +02:00
uterror.c ACPICA: Drop leading newlines from error messages 2018-06-30 23:24:04 +02:00
uteval.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utexcep.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utglobal.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
uthex.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utids.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utinit.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utlock.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utmath.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utmisc.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utmutex.c ACPICA: Convert acpi_gbl_hardware lock back to an acpi_raw_spinlock 2018-05-10 17:18:45 +02:00
utnonansi.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utobject.c ACPICA: Mark acpi_ut_create_internal_object_dbg() memory allocations as non-leaks 2018-05-27 12:23:03 +02:00
utosi.c ACPICA: Recognize the _OSI string "Windows 2017.2" 2018-06-10 13:19:50 +02:00
utownerid.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utpredef.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utprint.c ACPICA: vsnprintf: this statement may fall through 2018-05-15 10:16:10 +02:00
utresdecode.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utresrc.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utstate.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utstring.c ACPICA: Improve error messages for the namespace root node 2018-05-15 10:16:10 +02:00
utstrsuppt.c ACPICA: Utilities: split hex detection into smaller functions 2018-08-14 23:49:13 +02:00
utstrtoul64.c ACPICA: Utilities: split hex detection into smaller functions 2018-08-14 23:49:13 +02:00
uttrack.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utuuid.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utxface.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utxferror.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00
utxfinit.c ACPICA: Cleanup/simplify module-level code support 2018-03-18 19:29:46 +01:00
utxfmutex.c ACPICA: adding SPDX headers 2018-03-18 19:08:05 +01:00