From: Pete Zaitcev <zaitcev@redhat.com>
To: Oliver Neukum <oneukum@suse.com>
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
Alan Stern <stern@rowland.harvard.edu>,
zaitcev@redhat.com
Subject: Re: [PATCH] usblp: poison URBs upon disconnect
Date: Fri, 15 May 2020 15:31:49 -0500 [thread overview]
Message-ID: <20200515153149.19f5b4ee@suzdal.zaitcev.lan> (raw)
In-Reply-To: <20200507085806.5793-1-oneukum@suse.com>
On Thu, 7 May 2020 10:58:06 +0200
Oliver Neukum <oneukum@suse.com> wrote:
> syzkaller reported an URB that should have been killed to be active.
> We do not understand it, but this should fix the issue if it is real.
> @@ -1375,9 +1376,11 @@ static void usblp_disconnect(struct usb_interface *intf)
>
> usblp_unlink_urbs(usblp);
> mutex_unlock(&usblp->mut);
> + usb_poison_anchored_urbs(&usblp->urbs);
>
> if (!usblp->used)
> usblp_cleanup(usblp);
> mutex_unlock(&usblp_mutex);
> }
Sorry, it took me this long to think about it. I am against the duplication
of effort between usblp_unlink_urbs, which is exactly usb_kill_anchored_urbs,
and usb_poison_anchored_urbs. If you think that poisoning may help against
what the bot identified, we may try this instead:
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index 0d8e3f3804a3..eae5eaf5d4f1 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -1373,7 +1373,7 @@ static void usblp_disconnect(struct usb_interface *intf)
wake_up(&usblp->rwait);
usb_set_intfdata(intf, NULL);
- usblp_unlink_urbs(usblp);
+ usb_poison_anchored_urbs(&usblp->urbs);
mutex_unlock(&usblp->mut);
if (!usblp->used)
I'm still concerned that we didn't identify the scenario tht led to bot's
findings.
The usblp->present was supposed to play a role of the poison pill, at the
driver level. The difference with poisoning the anchor is that ->present
is protected by the most outlying mutex, and therefore cannot be meaninfully
checked in URB callbacks. But the anchor's poison flag is protected by a
spinlock, so callbacks check it. But what does it matter for us? This driver
does not re-submit URBs from callbacks.
So, I'm suspicious of attempts to hit at the problem in the dark and hope
for a miracle.
-- Pete
next prev parent reply other threads:[~2020-05-15 20:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-07 8:58 [PATCH] usblp: poison URBs upon disconnect Oliver Neukum
2020-05-15 20:31 ` Pete Zaitcev [this message]
2020-05-18 7:53 ` Oliver Neukum
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=20200515153149.19f5b4ee@suzdal.zaitcev.lan \
--to=zaitcev@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=oneukum@suse.com \
--cc=stern@rowland.harvard.edu \
/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).