Re: [ibm-acpi-devel] [PATCH v1] platform/x86: thinkpad_acpi: Limit size when call strndup_user()

2020-07-14 Thread Hans de Goede
Hi, On 7/14/20 12:42 PM, Andy Shevchenko wrote: During conversion to use strndup_user() the commit 35d13c7a0512 ("platform/x86: thinkpad_acpi: Use strndup_user() in dispatch_proc_write()") missed the fact that buffer coming thru procfs is not immediately NULL terminated. We have to limit size wh

[ibm-acpi-devel] [PATCH v1] platform/x86: thinkpad_acpi: Limit size when call strndup_user()

2020-07-14 Thread Andy Shevchenko
During conversion to use strndup_user() the commit 35d13c7a0512 ("platform/x86: thinkpad_acpi: Use strndup_user() in dispatch_proc_write()") missed the fact that buffer coming thru procfs is not immediately NULL terminated. We have to limit size when calling strndup_user(). Fixes: 35d13c7a0512 ("p

Re: [ibm-acpi-devel] [PATCH 5.8 regression fix] platform/x86: thinkpad_acpi: Revert: Use strndup_user() in dispatch_proc_write()

2020-07-14 Thread Andy Shevchenko
On Tue, Jul 14, 2020 at 12:33 PM Hans de Goede wrote: > On 7/14/20 10:27 AM, Andy Shevchenko wrote: > > On Tue, Jul 14, 2020 at 11:21 AM Andy Shevchenko > > wrote: > >> On Tue, Jul 14, 2020 at 11:15 AM Hans de Goede wrote: > >>> > >>> Commit 35d13c7a0512 ("platform/x86: thinkpad_acpi: Use strndu

Re: [ibm-acpi-devel] [PATCH 5.8 regression fix] platform/x86: thinkpad_acpi: Revert: Use strndup_user() in dispatch_proc_write()

2020-07-14 Thread Hans de Goede
Hi, On 7/14/20 10:27 AM, Andy Shevchenko wrote: On Tue, Jul 14, 2020 at 11:21 AM Andy Shevchenko wrote: On Tue, Jul 14, 2020 at 11:15 AM Hans de Goede wrote: Commit 35d13c7a0512 ("platform/x86: thinkpad_acpi: Use strndup_user() in dispatch_proc_write()") cleaned up dispatch_proc_write() by

Re: [ibm-acpi-devel] [PATCH 5.8 regression fix] platform/x86: thinkpad_acpi: Revert: Use strndup_user() in dispatch_proc_write()

2020-07-14 Thread Andy Shevchenko
On Tue, Jul 14, 2020 at 11:21 AM Andy Shevchenko wrote: > On Tue, Jul 14, 2020 at 11:15 AM Hans de Goede wrote: > > > > Commit 35d13c7a0512 ("platform/x86: thinkpad_acpi: Use strndup_user() > > in dispatch_proc_write()") cleaned up dispatch_proc_write() by replacing > > the code to copy the passe

Re: [ibm-acpi-devel] [PATCH 5.8 regression fix] platform/x86: thinkpad_acpi: Revert: Use strndup_user() in dispatch_proc_write()

2020-07-14 Thread Andy Shevchenko
On Tue, Jul 14, 2020 at 11:15 AM Hans de Goede wrote: > > Commit 35d13c7a0512 ("platform/x86: thinkpad_acpi: Use strndup_user() > in dispatch_proc_write()") cleaned up dispatch_proc_write() by replacing > the code to copy the passed in data from userspae with strndup_user(). user space > But str

[ibm-acpi-devel] [PATCH 5.8 regression fix] platform/x86: thinkpad_acpi: Revert: Use strndup_user() in dispatch_proc_write()

2020-07-14 Thread Hans de Goede
Commit 35d13c7a0512 ("platform/x86: thinkpad_acpi: Use strndup_user() in dispatch_proc_write()") cleaned up dispatch_proc_write() by replacing the code to copy the passed in data from userspae with strndup_user(). But strndup_user() expects a 0 terminated input buffer and the buffer passed to disp