linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Jia-Ju Bai <baijiaju1990@gmail.com>
Cc: johan@kernel.org, gregkh@linuxfoundation.org,
	pberger@brimson.com, alborchers@steinerpoint.com,
	linux-usb@vger.kernel.org
Subject: usb/io_edgeport: Fix a possible sleep-in-atomic bug in edge_bulk_in_callback
Date: Thu, 14 Dec 2017 11:07:28 +0100	[thread overview]
Message-ID: <20171214100728.GF5185@localhost> (raw)

On Wed, Dec 13, 2017 at 08:34:36PM +0800, Jia-Ju Bai wrote:
> According to drivers/usb/serial/io_edgeport.c, the driver may sleep 
> under a spinlock.
> The function call path is:
> edge_bulk_in_callback (acquire the spinlock)
>    process_rcvd_data
>      process_rcvd_status
>        change_port_settings
>          send_iosp_ext_cmd
>            write_cmd_usb
>              usb_kill_urb --> may sleep
> 
> To fix it, usb_kill_urb() is removed from the error path after usb_submit_urb() fails.

I added a "the redundant" before "usb_kill_urb()" in the above sentence
to make it more clear why this was done.

> This possible bug is found by my static analysis tool (DSAC) and checked by my code review.

And line-wrapped you commit message (at about 72 columns).

I also used a common prefix and shortened the summary to:

	USB: serial: io_edgeport: fix possible sleep-in-atomic

Just some minor nits, that you can keep in mind for your next patch
submission.

> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>

Thanks for reporting and fixing this. Now applied for -next.

Johan
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2017-12-14 10:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-14 10:07 Johan Hovold [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-12-13 12:34 usb/io_edgeport: Fix a possible sleep-in-atomic bug in edge_bulk_in_callback 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=20171214100728.GF5185@localhost \
    --to=johan@kernel.org \
    --cc=alborchers@steinerpoint.com \
    --cc=baijiaju1990@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pberger@brimson.com \
    /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).