From: Jiri Kosina <jikos@kernel.org>
To: Jia-Ju Bai <baijiaju1990@gmail.com>
Cc: benjamin.tissoires@redhat.com, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hid: hid-core: Fix a sleep-in-atomic-context bug in __hid_request()
Date: Wed, 5 Sep 2018 10:29:29 +0200 (CEST) [thread overview]
Message-ID: <nycvar.YFH.7.76.1809051026540.15880@cbobk.fhfr.pm> (raw)
In-Reply-To: <20180901121659.1257-1-baijiaju1990@gmail.com>
On Sat, 1 Sep 2018, Jia-Ju Bai wrote:
> The driver may sleep with holding a spinlock.
>
> The function call paths (from bottom to top) in Linux-4.16 are:
>
> [FUNC] hid_alloc_report_buf(GFP_KERNEL)
> drivers/hid/hid-core.c, 1435:
> hid_alloc_report_buf in __hid_request
> ./include/linux/hid.h, 1023:
> __hid_request in hid_hw_request
> drivers/hid/hid-picolcd_core.c, 111:
> hid_hw_request in picolcd_send_and_wait
> drivers/hid/hid-picolcd_core.c, 100:
> _raw_spin_lock_irqsave in picolcd_send_and_wait
>
> [FUNC] hid_alloc_report_buf(GFP_KERNEL)
> drivers/hid/hid-core.c, 1435:
> hid_alloc_report_buf in __hid_request
> ./include/linux/hid.h, 1023:
> __hid_request in hid_hw_request
> drivers/hid/hid-picolcd_core.c, 245:
> hid_hw_request in picolcd_reset
> drivers/hid/hid-picolcd_core.c, 235:
> _raw_spin_lock_irqsave in picolcd_reset
>
> [FUNC] hid_alloc_report_buf(GFP_KERNEL)
> drivers/hid/hid-core.c, 1435:
> hid_alloc_report_buf in __hid_request
> ./include/linux/hid.h, 1023:
> __hid_request in hid_hw_request
> drivers/hid/hid-picolcd_fb.c, 215:
> hid_hw_request in picolcd_fb_reset
> drivers/hid/hid-picolcd_fb.c, 206:
> _raw_spin_lock_irqsave in picolcd_fb_reset
>
> [FUNC] hid_alloc_report_buf(GFP_KERNEL)
> drivers/hid/hid-core.c, 1435:
> hid_alloc_report_buf in __hid_request
> ./include/linux/hid.h, 1023:
> __hid_request in hid_hw_request
> drivers/hid/hid-lg4ff.c, 465:
> hid_hw_request in lg4ff_play
> drivers/hid/hid-lg4ff.c, 441:
> _raw_spin_lock_irqsave in lg4ff_play
>
> To fix this bug, GFP_KERNEL is replaced with GFP_ATOMIC.
>
> This bug is found by my static analysis tool DSAC.
Could you please rewrite the changelog so that it's human readable? The
above is a bit hard to understand, I think something along the lines of
"__hid_request() has to be allocating with GFP_ATOMIC because there are
the following callchains leading to __hid_request() being an atomic
context: ... a->b->c.._hid_request()" etc.
Thanks,
--
Jiri Kosina
SUSE Labs
next prev parent reply other threads:[~2018-09-05 8:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-01 12:16 [PATCH] hid: hid-core: Fix a sleep-in-atomic-context bug in __hid_request() Jia-Ju Bai
2018-09-05 8:29 ` Jiri Kosina [this message]
2018-09-06 2:35 ` Jia-Ju Bai
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=nycvar.YFH.7.76.1809051026540.15880@cbobk.fhfr.pm \
--to=jikos@kernel.org \
--cc=baijiaju1990@gmail.com \
--cc=benjamin.tissoires@redhat.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@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