Commit 22a7f585 authored by Prashanth K's avatar Prashanth K Committed by Todd Kjos
Browse files

FROMGIT: usb: gadget: u_serial: Avoid spinlock recursion in __gs_console_push



When serial console over USB is enabled, gs_console_connect
queues gs_console_work, where it acquires the spinlock and
queues the usb request, and this request goes to gadget layer.
Now consider a situation where gadget layer prints something
to dmesg, this will eventually call gs_console_write() which
requires cons->lock. And this causes spinlock recursion. Avoid
this by excluding usb_ep_queue from the spinlock.

 spin_lock_irqsave //needs cons->lock
 gs_console_write
	.
	.
 _printk
 __warn_printk
 dev_warn/pr_err
	.
	.
 [USB Gadget Layer]
	.
	.
 usb_ep_queue
 gs_console_work
 __gs_console_push // acquires cons->lock
 process_one_work

Signed-off-by: default avatarPrashanth K <quic_prashk@quicinc.com>
Link: https://lore.kernel.org/r/1683638872-6885-1-git-send-email-quic_prashk@quicinc.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 285504023
(cherry picked from commit e5990469
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/

 usb-next)

Signed-off-by: default avatarPrashanth K <quic_prashk@quicinc.com>
Change-Id: I71a42cc94b72039466f3d1d09004da3f4cc0f34c
parent 3ff3fb3e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment