[lkml]   [2020]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] usb: storage: alauda: fix possible buffer overflow casued by bad DMA value in alauda_read_map()
On Sat, May 30, 2020 at 10:42:30PM +0800, Jia-Ju Bai wrote:
> From: Jia-Ju Bai <>
> The value us->iobuf is stored in DMA memory, and it is assigned to data,
> so data[6] and data[7] can be modified at anytime by malicious hardware.
> In this case, data[6] ^ data[7] can be a quite large number, which may
> cause buffer overflow when the code "parity[data[6] ^ data[7]]" is
> executed.
> To fix this possible bug, data[6] ^ data[7] is assigned to a local
> variable, and then this variable is checked before being used.

There are much worse problems than this in the alauda driver. For
example, alauda_get_redu_data() does I/O from a data buffer on the
stack; this is not allowed. That's just the example I noticed; there
may very well be others.

If you want to fix something, fix that.

If you're still worried about malicious hardware, the way to fix the
problem is not to change this one location. Instead, you should modify
the driver so that us->iobuf is not stored in DMA memory.

Alan Stern

 \ /
  Last update: 2020-05-30 18:00    [W:0.032 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site