Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2018-07-09 10:55:17 +0200
committerTakashi Iwai <tiwai@suse.de>2018-07-09 10:55:17 +0200
commitba06e3b6a40b545f00481a9b3c0ed5fbd7ea9070 (patch)
tree126de9eca7e35da37bf7bf56d61e6c7c8d38ed0a
parentd20afb8cc66d4e97b3a90b18589ed66113d79638 (diff)
ARM: amba: Don't read past the end of sysfs "driver_override"
buffer (CVE-2018-9385,bsc#1100491).
-rw-r--r--patches.drivers/ARM-amba-Don-t-read-past-the-end-of-sysfs-driver_ove39
-rw-r--r--series.conf2
2 files changed, 41 insertions, 0 deletions
diff --git a/patches.drivers/ARM-amba-Don-t-read-past-the-end-of-sysfs-driver_ove b/patches.drivers/ARM-amba-Don-t-read-past-the-end-of-sysfs-driver_ove
new file mode 100644
index 0000000000..b3b0af9359
--- /dev/null
+++ b/patches.drivers/ARM-amba-Don-t-read-past-the-end-of-sysfs-driver_ove
@@ -0,0 +1,39 @@
+From d2ffed5185df9d8d9ccd150e4340e3b6f96a8381 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Tue, 10 Apr 2018 15:21:45 +0200
+Subject: [PATCH] ARM: amba: Don't read past the end of sysfs "driver_override" buffer
+Git-commit: d2ffed5185df9d8d9ccd150e4340e3b6f96a8381
+Patch-mainline: v4.17-rc3
+References: CVE-2018-9385,bsc#1100491
+
+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.
+
+Cfr. commits 4efe874aace57dba ("PCI: Don't read past the end of sysfs
+"driver_override" buffer") and bf563b01c2895a4b ("driver core: platform:
+Don't read past the end of "driver_override" buffer").
+
+Fixes: 3cf385713460eb2b ("ARM: 8256/1: driver coamba: add device binding path 'driver_override'")
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Reviewed-by: Todd Kjos <tkjos@google.com>
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Acked-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ drivers/amba/bus.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/amba/bus.c
++++ b/drivers/amba/bus.c
+@@ -82,7 +82,8 @@ static ssize_t driver_override_store(str
+ struct amba_device *dev = to_amba_device(_dev);
+ char *driver_override, *old = dev->driver_override, *cp;
+
+- if (count > PATH_MAX)
++ /* We need to keep extra room for a newline */
++ if (count >= (PAGE_SIZE - 1))
+ return -EINVAL;
+
+ driver_override = kstrndup(buf, count, GFP_KERNEL);
diff --git a/series.conf b/series.conf
index eafa5a411a..7378018fe9 100644
--- a/series.conf
+++ b/series.conf
@@ -1672,6 +1672,8 @@
patches.fixes/0001-arm64-Use-full-path-in-KBUILD_IMAGE-definition.patch
patches.fixes/0002-arm-Use-full-path-in-KBUILD_IMAGE-definition.patch
+ patches.drivers/ARM-amba-Don-t-read-past-the-end-of-sysfs-driver_ove
+
########################################################
# S/390
########################################################