From: Krzysztof Kozlowski Date: Thu, 16 Jun 2016 06:27:36 +0000 (+0200) Subject: serial: samsung: Fix possible out of bounds access on non-DT platform X-Git-Tag: v3.2.84~148 X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=commitdiff_plain;h=df47dba115bbac341b8d25bf851ad3d831fc0e03;hp=f64965a7001c02be726e6df396136ac4f93258df;ds=sidebyside serial: samsung: Fix possible out of bounds access on non-DT platform commit 926b7b5122c96e1f18cd20e85a286c7ec8d18c97 upstream. On non-DeviceTree platforms, the index of serial device is a static variable incremented on each probe. It is incremented even if deferred probe happens when getting the clock in s3c24xx_serial_init_port(). This index is used for referencing elements of statically allocated s3c24xx_serial_ports array. In case of re-probe, the index will point outside of this array leading to memory corruption. Increment the index only on successful probe. Reported-by: Bartlomiej Zolnierkiewicz Fixes: b497549a035c ("[ARM] S3C24XX: Split serial driver into core and per-cpu drivers") Signed-off-by: Krzysztof Kozlowski Signed-off-by: Greg Kroah-Hartman [bwh: Backported to 3.2: adjust context] Signed-off-by: Ben Hutchings --- Reading git-diff-tree failed