linux-stable/net/nfc
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
..
hci NFC: Fix possible memory corruption when handling SHDLC I-Frame commands 2018-09-18 19:55:01 -07:00
nci net: nfc: nci: fix a possible sleep-in-atomic-context bug in nci_uart_tty_receive() 2019-12-31 16:34:38 +01:00
af_nfc.c net: socket: mark socket protocol handler structs as const 2017-05-16 11:54:07 -04:00
core.c NFC: Convert timers to use timer_setup() 2017-11-06 01:12:10 +01:00
digital.h
digital_core.c NFC: digital: Abort cmd when deactivating target 2017-11-10 00:03:39 +01:00
digital_dep.c NFC: digital: NFC-DEP Target WT(nfcdep,max) is now 14 2017-06-23 00:19:59 +02:00
digital_technology.c NFC: digital: NFC-A SEL_RES must be one byte 2017-06-23 00:19:59 +02:00
Kconfig
llcp.h net: Pass kern from net_proto_family.create to sk_alloc 2015-05-11 10:50:17 -04:00
llcp_commands.c net: nfc: Fix NULL dereference on nfc_llcp_build_tlv fails 2019-03-10 07:17:18 +01:00
llcp_core.c net: nfc: Fix NULL dereference on nfc_llcp_build_tlv fails 2019-03-10 07:17:18 +01:00
llcp_sock.c net: use skb_queue_empty_lockless() in poll() handlers 2019-11-10 11:27:48 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
netlink.c nfc: netlink: fix double device reference drop 2019-11-12 19:20:30 +01:00
nfc.h nfc: netlink: HCI event connectivity implementation 2015-12-29 19:06:20 +01:00
rawsock.c Revert changes to convert to ->poll_mask() and aio IOCB_CMD_POLL 2018-06-28 10:40:47 -07:00