Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1423706
| Path | csiph.com!news.mixmin.net!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Krzysztof Kozlowski <k.kozlowski@samsung.com> |
| Newsgroups | linux.kernel |
| Subject | [RESEND PATCH v2 2/2] serial: samsung: Fix possible out of bounds access on non-DT platform |
| Date | Thu, 16 Jun 2016 08:30:06 +0200 |
| Message-ID | <rKyYu-4LB-19@gated-at.bofh.it> (permalink) |
| References | <rKyYu-4LB-13@gated-at.bofh.it> |
| X-Original-To | Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jiri Slaby <jslaby@suse.com>, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org |
| X-Auditid | cbfec7f5-f792a6d000001302-4d-576246e035fa |
| X-Mailer | git-send-email 1.9.1 |
| X-Brightmail-Tracker | H4sIAAAAAAAAA+NgFlrBLMWRmVeSWpSXmKPExsVy+t/xy7oP3JLCDT4vU7L4O+kYu8XGGetZ LZoXr2ezePN2DZPFlA0fmCxevzC0eLr5MZPF5V1z2CzOLO5ld+D0+P1rEqPHplWdbB77565h 99jSf5fdo2/LKkaP9Vuusnh83iQXwB7FZZOSmpNZllqkb5fAlXFu3RPGghO8FX+vvWFuYJzL 3cXIySEhYCLRc2UiG4QtJnHh3nogm4tDSGApo8SBI2uZIZxGJom+xoNMIFVsAsYSm5cvAasS EZjIKHHs8DYWEIdZ4BKjxJv1U8GqhAXSJCb83wRmswioStzZ+YEdxOYVcJdY8nk6I8Q+OYmT xyazdjFycHAKeEi0TJIECQsBlXy4fIZ1AiPvAkaGVYyiqaXJBcVJ6blGesWJucWleel6yfm5 mxgh4fd1B+PSY1aHGAU4GJV4eAXWJ4YLsSaWFVfmHmKU4GBWEuF9YJ8ULsSbklhZlVqUH19U mpNafIhRmoNFSZx35q73IUIC6YklqdmpqQWpRTBZJg5OqQZG4djDfKeueyyoWb1b7WetmNC7 KS+qi0wzbkcaLi+pWcheXncxMS7BIGfik0fzOo3P8ZytTf4q8mfuB6uy4AUHHAU6kmf+lu46 b7u19pN+/mbp/besnHvVBPUvdAociHvH/bK5R2tdkIeN7uuW7QUF81pZcgPd7ALt/pQ7upw7 Ep1xiHnxuWglluKMREMt5qLiRADiZVGTOwIAAA== |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 51 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Kevin Hilman <khilman@kernel.org>, Javier Martinez Canillas <javier@osg.samsung.com>, arnd@arndb.de, Krzysztof Kozlowski <k.kozlowski@samsung.com>, Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> |
| X-Original-Date | Thu, 16 Jun 2016 08:27:36 +0200 |
| X-Original-Message-ID | <1466058456-31449-2-git-send-email-k.kozlowski@samsung.com> |
| X-Original-References | <1466058456-31449-1-git-send-email-k.kozlowski@samsung.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1423706 |
Show key headers only | View raw
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 <b.zolnierkie@samsung.com>
Fixes: b497549a035c ("[ARM] S3C24XX: Split serial driver into core and per-cpu drivers")
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
Not cc-ing stable because:
1. It is just a possibility, not really reproduced (I don't have non-DT
platform).
2. I am not sure whether deferred probe may happen on non-DT platform.
Changes since v1:
1. New patch.
---
drivers/tty/serial/samsung.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index f0bd2ec0db59..4d2924f61e0b 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1844,8 +1844,6 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
ourport->min_dma_size = max_t(int, ourport->port.fifosize,
dma_get_cache_alignment());
- probe_index++;
-
dbg("%s: initialising port %p...\n", __func__, ourport);
ret = s3c24xx_serial_init_port(ourport, pdev);
@@ -1875,6 +1873,8 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
if (ret < 0)
dev_err(&pdev->dev, "failed to add cpufreq notifier\n");
+ probe_index++;
+
return 0;
}
--
1.9.1
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[RESEND PATCH v2 1/2] serial: samsung: Fix ERR pointer dereference on deferred probe Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-06-16 08:30 +0200 [RESEND PATCH v2 2/2] serial: samsung: Fix possible out of bounds access on non-DT platform Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-06-16 08:30 +0200
csiph-web