On Sat, May 30, 2020 at 10:42:30PM +0800, Jia-Ju Bai wrote: > From: Jia-Ju Bai <baijiaju1990@xxxxxxxxx> > > 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