diff options
author | Peter Holik <peter@holik.at> | 2011-03-18 13:47:44 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-03-23 16:14:31 -0400 |
commit | adaa3c6342b249548ea830fe8e02aa5b45be8688 (patch) | |
tree | 91ebde06e253d49c59c25384aceb43fd438aad38 /drivers/usb/misc/uss720.c | |
parent | 45567c28d29a8766a67c53f898d502aef71b7ef0 (diff) |
USB: uss720 fixup refcount position
My testprog do a lot of bitbang - after hours i got following warning and my machine lockups:
WARNING: at /build/buildd/linux-2.6.38/lib/kref.c:34
After debugging uss720 driver i discovered that the completion callback was called before
usb_submit_urb returns. The callback frees the request structure that is krefed on return by
usb_submit_urb.
Signed-off-by: Peter Holik <peter@holik.at>
Acked-by: Thomas Sailer <t.sailer@alumni.ethz.ch>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/misc/uss720.c')
-rw-r--r-- | drivers/usb/misc/uss720.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c index f7a205738032..8b1d94a76914 100644 --- a/drivers/usb/misc/uss720.c +++ b/drivers/usb/misc/uss720.c | |||
@@ -177,12 +177,11 @@ static struct uss720_async_request *submit_async_request(struct parport_uss720_p | |||
177 | spin_lock_irqsave(&priv->asynclock, flags); | 177 | spin_lock_irqsave(&priv->asynclock, flags); |
178 | list_add_tail(&rq->asynclist, &priv->asynclist); | 178 | list_add_tail(&rq->asynclist, &priv->asynclist); |
179 | spin_unlock_irqrestore(&priv->asynclock, flags); | 179 | spin_unlock_irqrestore(&priv->asynclock, flags); |
180 | kref_get(&rq->ref_count); | ||
180 | ret = usb_submit_urb(rq->urb, mem_flags); | 181 | ret = usb_submit_urb(rq->urb, mem_flags); |
181 | if (!ret) { | 182 | if (!ret) |
182 | kref_get(&rq->ref_count); | ||
183 | return rq; | 183 | return rq; |
184 | } | 184 | destroy_async(&rq->ref_count); |
185 | kref_put(&rq->ref_count, destroy_async); | ||
186 | err("submit_async_request submit_urb failed with %d", ret); | 185 | err("submit_async_request submit_urb failed with %d", ret); |
187 | return NULL; | 186 | return NULL; |
188 | } | 187 | } |