All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Zheyu Ma <zheyuma97@gmail.com>
Cc: cernekee@gmail.com, jirislaby@kernel.org,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] serial: rp2: disable interrupt in rp2_probe():
Date: Thu, 20 May 2021 16:30:05 +0200	[thread overview]
Message-ID: <YKZybdcwoI1eMbzj@kroah.com> (raw)
In-Reply-To: <1620991027-25856-1-git-send-email-zheyuma97@gmail.com>

On Fri, May 14, 2021 at 11:17:07AM +0000, Zheyu Ma wrote:
> In 'rp2_probe', the driver registers 'rp2_uart_interrupt' then calls
> 'rp2_fw_cb' through 'request_firmware_nowait'. In 'rp2_fw_cb', if the
> firmware don't exists, function just return without initializing ports
> of 'rp2_card'. But now the interrupt handler function has been registered,
> and when an interrupt comes('rp2' may shares an interrupt line with other
> devices), 'rp2_uart_interrupt' may access those ports then causing NULL
> pointer dereference or other bugs.
> 
> Fix this by disabling interrupt after registering 'rp2_uart_interrupt',
> and enable it in 'rp2_uart_startup'.

What prevents an interrupt from coming in right after callin
rp2_uart_interrupt()?  The driver has to be able to handle that.  Why is
the interrupt being registered before the firmware is loaded?  That
should be the proper fix as once you register an interrupt, the driver
HAS to be able to properly handle it.

thanks,

greg k-h

  reply	other threads:[~2021-05-20 14:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-14 11:17 [PATCH] serial: rp2: disable interrupt in rp2_probe(): Zheyu Ma
2021-05-20 14:30 ` Greg KH [this message]
2021-05-21  5:09   ` Zheyu Ma

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=YKZybdcwoI1eMbzj@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=cernekee@gmail.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=zheyuma97@gmail.com \
    /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.