linux-stable/drivers/nfc
Minsuk Kang 0ca78c9965 nfc: pn533: Wait for out_urb's completion in pn533_usb_send_frame()
[ Upstream commit 9dab880d67 ]

Fix a use-after-free that occurs in hcd when in_urb sent from
pn533_usb_send_frame() is completed earlier than out_urb. Its callback
frees the skb data in pn533_send_async_complete() that is used as a
transfer buffer of out_urb. Wait before sending in_urb until the
callback of out_urb is called. To modify the callback of out_urb alone,
separate the complete function of out_urb and ack_urb.

Found by a modified version of syzkaller.

BUG: KASAN: use-after-free in dummy_timer
Call Trace:
 memcpy (mm/kasan/shadow.c:65)
 dummy_perform_transfer (drivers/usb/gadget/udc/dummy_hcd.c:1352)
 transfer (drivers/usb/gadget/udc/dummy_hcd.c:1453)
 dummy_timer (drivers/usb/gadget/udc/dummy_hcd.c:1972)
 arch_static_branch (arch/x86/include/asm/jump_label.h:27)
 static_key_false (include/linux/jump_label.h:207)
 timer_expire_exit (include/trace/events/timer.h:127)
 call_timer_fn (kernel/time/timer.c:1475)
 expire_timers (kernel/time/timer.c:1519)
 __run_timers (kernel/time/timer.c:1790)
 run_timer_softirq (kernel/time/timer.c:1803)

Fixes: c46ee38620 ("NFC: pn533: add NXP pn533 nfc device driver")
Signed-off-by: Minsuk Kang <linuxlovemin@yonsei.ac.kr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-01-18 11:44:59 +01:00
..
fdp nfc: fdp: Fix potential memory leak in fdp_nci_send() 2022-11-10 18:14:17 +01:00
microread
nfcmrvl nfc: nfcmrvl: Fix potential memory leak in nfcmrvl_i2c_nci_send() 2022-11-10 18:14:17 +01:00
nxp-nci nfc: nxp-nci: Fix potential memory leak in nxp_nci_send() 2022-11-10 18:14:17 +01:00
pn533 nfc: pn533: Wait for out_urb's completion in pn533_usb_send_frame() 2023-01-18 11:44:59 +01:00
pn544
s3fwrn5 nfc: s3fwrn5: Fix potential memory leak in s3fwrn5_nci_send() 2022-11-10 18:14:17 +01:00
st-nci nfc: st-nci: fix memory leaks in EVT_TRANSACTION 2022-12-02 17:40:02 +01:00
st21nfca nfc: st21nfca: fix incorrect sizing calculations in EVT_TRANSACTION 2022-06-14 18:32:46 +02:00
st95hf
Kconfig
Makefile
mei_phy.c
mei_phy.h
nfcsim.c
port100.c NFC: port100: fix use-after-free in port100_send_complete 2022-03-16 14:15:59 +01:00
trf7970a.c