lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Thu, 22 Jul 2021 17:04:25 +0800
From:   zhiyong tao <zhiyong.tao@...iatek.com>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
CC:     "timur@...nel.org" <timur@...nel.org>,
        "linux@...linux.org.uk" <linux@...linux.org.uk>,
        "alcooperx@...il.com" <alcooperx@...il.com>,
        "tklauser@...tanz.ch" <tklauser@...tanz.ch>,
        "sean.wang@...nel.org" <sean.wang@...nel.org>,
        "srv_heupstream@...iatek.com" <srv_heupstream@...iatek.com>,
        "hui.liu@...iatek.com" <hui.liu@...iatek.com>,
        "yuchen.huang@...iatek.com" <yuchen.huang@...iatek.com>,
        "huihui.wang@...iatek.com" <huihui.wang@...iatek.com>,
        "eddie.huang@...iatek.com" <eddie.huang@...iatek.com>,
        "sean.wang@...iatek.com" <sean.wang@...iatek.com>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "linux-mediatek@...ts.infradead.org" 
        <linux-mediatek@...ts.infradead.org>,
        "linux-serial@...r.kernel.org" <linux-serial@...r.kernel.org>
Subject: Re: [PATCH] uart: mediatek: fix memory corruption issue

On Wed, 2021-07-14 at 01:20 +0300, Andy Shevchenko wrote:
> 
> 
> On Saturday, July 10, 2021, Zhiyong Tao <zhiyong.tao@...iatek.com>
> wrote:
> 
> 
> Please, use “serial: 8260_mtk:” prefix.

==> Hi Andy,

Thanks for your suggestion.
we will change it in the next version.
> 
>         This patch is used to fix memory 
>         
> 
> 
> This is completely confusing start of the sentence. The form of “be
> used to” strongly suggests two things: 1) it was a patch to fix
> something; 2) it is not used anymore and never considered to be used
> again,
> 
> 
> Besides that Submitting Patches document highly recommends to avoid
> sentences that starts with “this patch”.
>  

==>We will change the commit message as "Fix uart corruption issue when
rx power off "in the next version.

Thanks.
>         
>         corruption issue when rx power off.
>         1. add spin lock in mtk8250_dma_rx_complete function in APDMA
>         mode.
>         2. add processing mechanism which count value is 0
>         
>         Signed-off-by: Zhiyong Tao <zhiyong.tao@...iatek.com>
>         ---
>          drivers/tty/serial/8250/8250_mtk.c | 15 +++++++++++----
>          1 file changed, 11 insertions(+), 4 deletions(-)
>         
>         diff --git a/drivers/tty/serial/8250/8250_mtk.c
>         b/drivers/tty/serial/8250/8250_mtk.c
>         index f7d3023f860f..09f7d2166315 100644
>         --- a/drivers/tty/serial/8250/8250_mtk.c
>         +++ b/drivers/tty/serial/8250/8250_mtk.c
>         @@ -91,12 +91,15 @@ static void mtk8250_dma_rx_complete(void
>         *param)
>                 struct mtk8250_data *data = up->port.private_data;
>                 struct tty_port *tty_port = &up->port.state->port;
>                 struct dma_tx_state state;
>         -       int copied, total, cnt;
>         +       unsigned int copied, total, cnt;
>                 unsigned char *ptr;
>         +       unsigned long flags;
>         
>                 if (data->rx_status == DMA_RX_SHUTDOWN)
>                         return;
>         
>         +       spin_lock_irqsave(&up->port.lock, flags);
>         +
>                 dmaengine_tx_status(dma->rxchan, dma->rx_cookie,
>         &state);
>                 total = dma->rx_size - state.residue;
>                 cnt = total;
>         @@ -104,9 +107,11 @@ static void mtk8250_dma_rx_complete(void
>         *param)
>                 if ((data->rx_pos + cnt) > dma->rx_size)
>                         cnt = dma->rx_size - data->rx_pos;
>         
>         -       ptr = (unsigned char *)(data->rx_pos + dma->rx_buf);
>         -       copied = tty_insert_flip_string(tty_port, ptr, cnt);
>         -       data->rx_pos += cnt;
>         +       if (cnt != 0) {
>         +               ptr = (unsigned char *)(data->rx_pos +
>         dma->rx_buf);
>         +               copied = tty_insert_flip_string(tty_port, ptr,
>         cnt);
>         +               data->rx_pos += cnt;
>         +       }
>         
>                 if (total > cnt) {
>                         ptr = (unsigned char *)(dma->rx_buf);
>         @@ -120,6 +125,8 @@ static void mtk8250_dma_rx_complete(void
>         *param)
>                 tty_flip_buffer_push(tty_port);
>         
>                 mtk8250_rx_dma(up);
>         +
>         +       spin_unlock_irqrestore(&up->port.lock, flags);
>          }
>         
>          static void mtk8250_rx_dma(struct uart_8250_port *up)
> 
> 

Powered by blists - more mailing lists