Linux-Serial Archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: kernel@pengutronix.de, linux-serial@vger.kernel.org
Subject: Re: NULL pointer dereference when closing a busy UART
Date: Tue, 16 Apr 2024 19:07:38 +0200	[thread overview]
Message-ID: <wmfb6m7gz5ym2exep4pgmtwqonxi5eqryif4herfkc5rbxxvre@eqnzhic3umux> (raw)
In-Reply-To: <Zh6Sb-Gk_RIdHkZi@smile.fi.intel.com>

[-- Attachment #1: Type: text/plain, Size: 1884 bytes --]

Hello Andy,

On Tue, Apr 16, 2024 at 05:59:59PM +0300, Andy Shevchenko wrote:
> On Tue, Apr 16, 2024 at 11:52:19AM +0200, Uwe Kleine-König wrote:
> > On Mon, Apr 15, 2024 at 10:04:39PM +0200, Uwe Kleine-König wrote:
> > > On Mon, Apr 15, 2024 at 10:36:44PM +0300, Andy Shevchenko wrote:
> > > > On Mon, Apr 15, 2024 at 07:15:54PM +0200, Uwe Kleine-König wrote:
> 
> ...
> 
> > > > You might need this
> > > > 
> > > > 1aa4ad4eb695 serial: core: Fix missing shutdown and startup for serial base port
> > > > 
> > > > on top btw.
> > > 
> > > Ah, that looks exactly like my issue. Thanks, I will test that an report
> > > back.
> > 
> > It improves my situation for sure. I have yet another problem with the
> > stm32 UART that is driver specfic. I'm working on that one now ...
> 
> Please, Cc me on that when publishing, I'm curious.

I don't have a fix yet, but the problem reproduces as follows:

I have a bridge between TX and RX; and also between RTS and CTS; there
is no DMA involved. I send a big amount of data and so receive that all.
This puts pressure on the receiving line discipline and so ->throttle()
is called.

->throttle() sets stm32_port->throttled = true; which makes the ISR (=
stm32_usart_interrupt()) stop handle USART_SR_RXNE (= RXFIFO not empty).
So the ISR is called in a tight loop. Stuck irq detection doesn't step
in because the ISR returns IRQ_HANDLED unconditionally. (For the latter
I already have a prototype patch.)

It's unclear to me yet, what to do. Some further things that are (maybe)
relevant are:

 - Without a rts-gpio the driver cannot toggle RTS. (Hardware
   limitation)
 - The driver makes no effort evaluating CTS.

Best regards
Uwe

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

      reply	other threads:[~2024-04-16 17:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-15 17:15 NULL pointer dereference when closing a busy UART Uwe Kleine-König
2024-04-15 19:36 ` Andy Shevchenko
2024-04-15 20:04   ` Uwe Kleine-König
2024-04-16  9:52     ` Uwe Kleine-König
2024-04-16 14:59       ` Andy Shevchenko
2024-04-16 17:07         ` Uwe Kleine-König [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=wmfb6m7gz5ym2exep4pgmtwqonxi5eqryif4herfkc5rbxxvre@eqnzhic3umux \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-serial@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).