linux-uconsole/net/nfc/nci
Jia-Ju Bai 5cc09cfdc3 net: nfc: nci: fix a possible sleep-in-atomic-context bug in nci_uart_tty_receive()
[ Upstream commit b7ac893652 ]

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-31 16:34:38 +01:00
..
core.c treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
data.c nfc: fix potential illegal memory access 2019-07-28 08:29:25 +02:00
hci.c NFC: nci: Add some bounds checking in nci_hci_cmd_received() 2019-05-16 19:41:27 +02:00
Kconfig NFC: NCI: move generic spi driver to a module 2015-10-27 04:21:38 +01:00
lib.c
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ntf.c nfc: nci: Add an additional parameter to identify a connection id 2016-05-04 01:43:21 +02:00
rsp.c nfc: nci: Add an additional parameter to identify a connection id 2016-05-04 01:43:21 +02:00
spi.c networking: add and use skb_put_u8() 2017-06-16 11:48:40 -04:00
uart.c net: nfc: nci: fix a possible sleep-in-atomic-context bug in nci_uart_tty_receive() 2019-12-31 16:34:38 +01:00