Re: [PATCH tty/serial 1/1] tty: serial: imx: setup the correct sg entry for tx dma

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On Tue, Feb 11, 2020 at 02:16:01PM +0800, fugang.duan@xxxxxxx wrote:
> From: Fugang Duan <fugang.duan@xxxxxxx>
> 
> There has oops as below happen on i.MX8MP EVK platform that has
> 6G bytes DDR memory.
> 
> when (xmit->tail < xmit->head) && (xmit->head == 0),
> it setups one sg entry with sg->length is zero:
> 	sg_set_buf(sgl + 1, xmit->buf, xmit->head);
> 
> if xmit->buf is allocated from >4G address space, and SDMA only
> support <4G address space, then dma_map_sg() will call swiotlb_map()
> to do bounce buffer copying and mapping.
> 
> But swiotlb_map() don't allow sg entry's length is zero, otherwise
> report BUG_ON().
> 
> So the patch is to correct the tx DMA scatter list.
> 
> Oops:
> [...]

It's a bit sad this wasn't catched earlier. The fsl_lpuart driver got
this exact fix in 2016 (d704b2d32c39c256dea659e142a31b875a13c63b) and
obviously nobody looked left or right to check for other drivers being
affected. :-|

> Reported-by: Eagle Zhou <eagle.zhou@xxxxxxx>
> Tested-by: Eagle Zhou <eagle.zhou@xxxxxxx>
> Signed-off-by: Fugang Duan <fugang.duan@xxxxxxx>

Fixes: 7942f8577f2a ("serial: imx: TX DMA: clean up sg initialization")

(Also here nobody looked in detail: The commit log is obviously wrong as
the if condition isn't just inverted.)

Reviewed-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux