Commit 83196b52 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

[PATCH] gadgetfs: fix AIO interface bugs

This patch (as691) fixes a few errors in the AIO interface for the
gadgetfs driver.  Now requests will complete properly instead of hanging.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 212a4b4e
...@@ -528,7 +528,7 @@ struct kiocb_priv { ...@@ -528,7 +528,7 @@ struct kiocb_priv {
struct usb_request *req; struct usb_request *req;
struct ep_data *epdata; struct ep_data *epdata;
void *buf; void *buf;
char __user *ubuf; char __user *ubuf; /* NULL for writes */
unsigned actual; unsigned actual;
}; };
...@@ -566,7 +566,6 @@ static ssize_t ep_aio_read_retry(struct kiocb *iocb) ...@@ -566,7 +566,6 @@ static ssize_t ep_aio_read_retry(struct kiocb *iocb)
status = priv->actual; status = priv->actual;
kfree(priv->buf); kfree(priv->buf);
kfree(priv); kfree(priv);
aio_put_req(iocb);
return status; return status;
} }
...@@ -580,8 +579,8 @@ static void ep_aio_complete(struct usb_ep *ep, struct usb_request *req) ...@@ -580,8 +579,8 @@ static void ep_aio_complete(struct usb_ep *ep, struct usb_request *req)
spin_lock(&epdata->dev->lock); spin_lock(&epdata->dev->lock);
priv->req = NULL; priv->req = NULL;
priv->epdata = NULL; priv->epdata = NULL;
if (NULL == iocb->ki_retry if (priv->ubuf == NULL
|| unlikely(0 == req->actual) || unlikely(req->actual == 0)
|| unlikely(kiocbIsCancelled(iocb))) { || unlikely(kiocbIsCancelled(iocb))) {
kfree(req->buf); kfree(req->buf);
kfree(priv); kfree(priv);
...@@ -618,7 +617,7 @@ ep_aio_rwtail( ...@@ -618,7 +617,7 @@ ep_aio_rwtail(
char __user *ubuf char __user *ubuf
) )
{ {
struct kiocb_priv *priv = (void *) &iocb->private; struct kiocb_priv *priv;
struct usb_request *req; struct usb_request *req;
ssize_t value; ssize_t value;
...@@ -670,7 +669,7 @@ fail: ...@@ -670,7 +669,7 @@ fail:
kfree(priv); kfree(priv);
put_ep(epdata); put_ep(epdata);
} else } else
value = -EIOCBQUEUED; value = (ubuf ? -EIOCBRETRY : -EIOCBQUEUED);
return value; return value;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment