mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: baijiaju1990@gmail.com
Cc: gregkh@linuxfoundation.org, tglx@linutronix.de,
	allison@lohutok.net, alexios.zavras@intel.com,
	alexandru.ardelean@analog.com, albin_yang@163.com,
	dan.carpenter@oracle.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: nfc: nci: fix a possible sleep-in-atomic-context bug in nci_uart_tty_receive()
Date: Wed, 18 Dec 2019 11:58:24 -0800 (PST)	[thread overview]
Message-ID: <20191218.115824.2176259916744178647.davem@davemloft.net> (raw)
In-Reply-To: <20191218092155.5030-1-baijiaju1990@gmail.com>

From: Jia-Ju Bai <baijiaju1990@gmail.com>
Date: Wed, 18 Dec 2019 17:21:55 +0800

> The kernel may sleep while holding a spinlock.
> The function call path (from bottom to top) in Linux 4.19 is:
> 
> net/nfc/nci/uart.c, 349: 
> 	nci_skb_alloc in nci_uart_default_recv_buf
> net/nfc/nci/uart.c, 255: 
> 	(FUNC_PTR)nci_uart_default_recv_buf in nci_uart_tty_receive
> net/nfc/nci/uart.c, 254: 
> 	spin_lock in nci_uart_tty_receive
> 
> nci_skb_alloc(GFP_KERNEL) can sleep at runtime.
> (FUNC_PTR) means a function pointer is called.
> 
> To fix this bug, GFP_KERNEL is replaced with GFP_ATOMIC for
> nci_skb_alloc().
> 
> This bug is found by a static analysis tool STCheck written by myself.
> 
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>

Applied and queued up for -stable, thanks.

      reply	other threads:[~2019-12-18 19:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-18  9:21 Jia-Ju Bai
2019-12-18 19:58 ` David Miller [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=20191218.115824.2176259916744178647.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=albin_yang@163.com \
    --cc=alexandru.ardelean@analog.com \
    --cc=alexios.zavras@intel.com \
    --cc=allison@lohutok.net \
    --cc=baijiaju1990@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®