Re: [PATCH] [SCSI] esas2r: fix possible buffer overflow caused by bad DMA value in esas2r_process_vda_ioctl()

Greg KH
2024-11-07T15:08:46Z

On Thu, Nov 07, 2024 at 07:36:17PM +0800, Qiu-ji Chen wrote:
> In line 1854 of the file esas2r_ioctl.c, the function
> esas2r_process_vda_ioctl() is called with the parameter vi being assigned
> the value of a->vda_buffer. On line 1892, a->vda_buffer is stored in DMA
> memory with the statement
> a->vda_buffer = dma_alloc_coherent(&a->pcid->dev, ..., indicating that the
> parameter vi passed to the function is also stored in DMA memory. This
> suggests that the parameter vi could be altered at any time by malicious
> hardware.

As James pointed out, "malicious hardware" is not a threat model that
Linux worries about at this point in time, sorry.

If you wish to have Linux care about this, random driver changes like
this is not going to be the way forward, but rather, major things need
to be rearchitected in order to "protect" the kernel from bad hardware.

But really, if you can't trust the hardware, you have bigger problems,
any software can't protect you from that :)

sorry,

greg k-h