netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@codeaurora.org>
To: Jia-Ju Bai <baijiaju1990@gmail.com>
Cc: ath9k-devel@qca.qualcomm.com, davem@davemloft.net,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ath9k: fix possible sleep-in-atomic-context bugs in hif_usb_send_regout()
Date: Wed, 18 Dec 2019 14:02:19 +0200	[thread overview]
Message-ID: <87h81xc050.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <20191218114533.9268-1-baijiaju1990@gmail.com> (Jia-Ju Bai's message of "Wed, 18 Dec 2019 19:45:33 +0800")

Jia-Ju Bai <baijiaju1990@gmail.com> writes:

> The driver may sleep while holding a spinlock.
> The function call path (from bottom to top) in Linux 4.19 is:
>
> drivers/net/wireless/ath/ath9k/hif_usb.c, 108: 
> 	usb_alloc_urb(GFP_KERNEL) in hif_usb_send_regout
> drivers/net/wireless/ath/ath9k/hif_usb.c, 470: 
> 	hif_usb_send_regout in hif_usb_send
> drivers/net/wireless/ath/ath9k/htc_hst.c, 34: 
> 	(FUNC_PTR)hif_usb_send in htc_issue_send
> drivers/net/wireless/ath/ath9k/htc_hst.c, 295: 
> 	htc_issue_send in htc_send
> drivers/net/wireless/ath/ath9k/htc_drv_beacon.c, 250: 
> 	htc_send in ath9k_htc_send_beacon
> drivers/net/wireless/ath/ath9k/htc_drv_beacon.c, 207: 
> 	spin_lock_bh in ath9k_htc_send_beacon
>
> drivers/net/wireless/ath/ath9k/hif_usb.c, 112: 
> 	kzalloc(GFP_KERNEL) in hif_usb_send_regout
> drivers/net/wireless/ath/ath9k/hif_usb.c, 470: 
> 	hif_usb_send_regout in hif_usb_send
> drivers/net/wireless/ath/ath9k/htc_hst.c, 34: 
> 	(FUNC_PTR)hif_usb_send in htc_issue_send
> drivers/net/wireless/ath/ath9k/htc_hst.c, 295: 
> 	htc_issue_send in htc_send
> drivers/net/wireless/ath/ath9k/htc_drv_beacon.c, 250: 
> 	htc_send in ath9k_htc_send_beacon
> drivers/net/wireless/ath/ath9k/htc_drv_beacon.c, 207: 
> 	spin_lock_bh in ath9k_htc_send_beacon
>
> drivers/net/wireless/ath/ath9k/hif_usb.c, 127: 
> 	usb_submit_urb(GFP_KERNEL) in hif_usb_send_regout
> drivers/net/wireless/ath/ath9k/hif_usb.c, 470: 
> 	hif_usb_send_regout in hif_usb_send
> drivers/net/wireless/ath/ath9k/htc_hst.c, 34: 
> 	(FUNC_PTR)hif_usb_send in htc_issue_send
> drivers/net/wireless/ath/ath9k/htc_hst.c, 295: 
> 	htc_issue_send in htc_send
> drivers/net/wireless/ath/ath9k/htc_drv_beacon.c, 250: 
> 	htc_send in ath9k_htc_send_beacon
> drivers/net/wireless/ath/ath9k/htc_drv_beacon.c, 207: 
> 	spin_lock_bh in ath9k_htc_send_beacon
>
> (FUNC_PTR) means a function pointer is called.
>
> To fix these bugs, GFP_KERNEL is replaced with GFP_ATOMIC.
>
> These bugs are found by a static analysis tool STCheck written by myself.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>

Can someone else verify this and provide Reviewed-by?

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-18 11:45 [PATCH] ath9k: fix possible sleep-in-atomic-context bugs in hif_usb_send_regout() Jia-Ju Bai
2019-12-18 12:02 ` Kalle Valo [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=87h81xc050.fsf@kamboji.qca.qualcomm.com \
    --to=kvalo@codeaurora.org \
    --cc=ath9k-devel@qca.qualcomm.com \
    --cc=baijiaju1990@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).