From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: stable@vger.kernel.org, Gilles BULOZ <gilles.buloz@kontron.com>
Subject: Re: [PATCH backport to 6.1 1/2] serial: 8250_dma: Fix DMA Rx completion race
Date: Tue, 7 Feb 2023 12:08:33 +0100 [thread overview]
Message-ID: <Y+IxMTr6afTorhG8@kroah.com> (raw)
In-Reply-To: <20230207094717.27197-1-ilpo.jarvinen@linux.intel.com>
On Tue, Feb 07, 2023 at 11:47:16AM +0200, Ilpo Järvinen wrote:
> [ Upstream commit 31352811e13dc2313f101b890fd4b1ce760b5fe7 ]
>
> __dma_rx_complete() is called from two places:
> - Through the DMA completion callback dma_rx_complete()
> - From serial8250_rx_dma_flush() after IIR_RLSI or IIR_RX_TIMEOUT
> The former does not hold port's lock during __dma_rx_complete() which
> allows these two to race and potentially insert the same data twice.
>
> Extend port's lock coverage in dma_rx_complete() to prevent the race
> and check if the DMA Rx is still pending completion before calling
> into __dma_rx_complete().
>
> Reported-by: Gilles BULOZ <gilles.buloz@kontron.com>
> Tested-by: Gilles BULOZ <gilles.buloz@kontron.com>
> Fixes: 9ee4b83e51f7 ("serial: 8250: Add support for dmaengine")
> Cc: stable@vger.kernel.org
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> Link: https://lore.kernel.org/r/20230130114841.25749-2-ilpo.jarvinen@linux.intel.com
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> drivers/tty/serial/8250/8250_dma.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
Thanks, both queued up now.
greg k-h
prev parent reply other threads:[~2023-02-07 11:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-07 9:47 [PATCH backport to 6.1 1/2] serial: 8250_dma: Fix DMA Rx completion race Ilpo Järvinen
2023-02-07 9:47 ` [PATCH backport to 6.1 2/2] serial: 8250_dma: Fix DMA Rx rearm race Ilpo Järvinen
2023-02-07 11:08 ` Greg Kroah-Hartman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y+IxMTr6afTorhG8@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=gilles.buloz@kontron.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.