]> git.baikalelectronics.ru Git - kernel.git/commit
driver core: platform: Don't read past the end of "driver_override" buffer
authorNicolai Stange <nstange@suse.de>
Mon, 11 Sep 2017 07:45:42 +0000 (09:45 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 18 Sep 2017 15:16:47 +0000 (17:16 +0200)
commit76cdf14cd54dc06e8e772cf9f187519b774f99a2
treea056ace162f3bde309cd5e763a1cd11aa8c3cc13
parent8acd92a2b87cef564508338b974fa638e8782492
driver core: platform: Don't read past the end of "driver_override" buffer

When printing the driver_override parameter when it is 4095 and 4094 bytes
long, the printing code would access invalid memory because we need count+1
bytes for printing.

Reject driver_override values of these lengths in driver_override_store().

This is in close analogy to commit 7a8b0be1e15b ("PCI: Don't read past the
end of sysfs "driver_override" buffer") from Sasha Levin.

Fixes: f5f2f5836e37 ("driver core: platform: add device binding path 'driver_override'")
Cc: stable@vger.kernel.org # v3.17+
Signed-off-by: Nicolai Stange <nstange@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/platform.c