From: Linyu Yuan <quic_linyyuan@quicinc.com>
To: John Keeping <john@metanate.com>, <linux-usb@vger.kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Shuah Khan <skhan@linuxfoundation.org>,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
Dan Carpenter <error27@gmail.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] usb: gadget: f_fs: use io_data->status consistently
Date: Fri, 25 Nov 2022 10:44:32 +0800 [thread overview]
Message-ID: <062fb756-e84a-68ba-1347-7a6e66d5ac0d@quicinc.com> (raw)
In-Reply-To: <20221124170430.3998755-1-john@metanate.com>
Reviewed-by: Linyu Yuan <quic_linyyuan@quicinc.com>
On 11/25/2022 1:04 AM, John Keeping wrote:
> Commit fb1f16d74e26 ("usb: gadget: f_fs: change ep->status safe in
> ffs_epfile_io()") added a new ffs_io_data::status field to fix lifetime
> issues in synchronous requests.
>
> While there are no similar lifetime issues for asynchronous requests
> (the separate ep member in ffs_io_data avoids them) using the status
> field means the USB request can be freed earlier and that there is more
> consistency between the synchronous and asynchronous I/O paths.
>
> Cc: Linyu Yuan <quic_linyyuan@quicinc.com>
> Signed-off-by: John Keeping <john@metanate.com>
> ---
> drivers/usb/gadget/function/f_fs.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
> index 73dc10a77cde..1221f0d1b1a9 100644
> --- a/drivers/usb/gadget/function/f_fs.c
> +++ b/drivers/usb/gadget/function/f_fs.c
> @@ -825,8 +825,7 @@ static void ffs_user_copy_worker(struct work_struct *work)
> {
> struct ffs_io_data *io_data = container_of(work, struct ffs_io_data,
> work);
> - int ret = io_data->req->status ? io_data->req->status :
> - io_data->req->actual;
> + int ret = io_data->status;
> bool kiocb_has_eventfd = io_data->kiocb->ki_flags & IOCB_EVENTFD;
>
> if (io_data->read && ret > 0) {
> @@ -840,8 +839,6 @@ static void ffs_user_copy_worker(struct work_struct *work)
> if (io_data->ffs->ffs_eventfd && !kiocb_has_eventfd)
> eventfd_signal(io_data->ffs->ffs_eventfd, 1);
>
> - usb_ep_free_request(io_data->ep, io_data->req);
> -
> if (io_data->read)
> kfree(io_data->to_free);
> ffs_free_buffer(io_data);
> @@ -856,6 +853,9 @@ static void ffs_epfile_async_io_complete(struct usb_ep *_ep,
>
> ENTER();
>
> + io_data->status = req->status ? req->status : req->actual;
> + usb_ep_free_request(_ep, req);
> +
> INIT_WORK(&io_data->work, ffs_user_copy_worker);
> queue_work(ffs->io_completion_wq, &io_data->work);
> }
prev parent reply other threads:[~2022-11-25 2:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-24 17:04 John Keeping
2022-11-25 2:44 ` Linyu Yuan [this message]
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=062fb756-e84a-68ba-1347-7a6e66d5ac0d@quicinc.com \
--to=quic_linyyuan@quicinc.com \
--cc=error27@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=john@metanate.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=wsa+renesas@sang-engineering.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
all inboxes | Powered by JetHome®