mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: mgautam@codeaurora.org
To: fei.yang@intel.com
Cc: balbi@kernel.org, gregkh@linuxfoundation.org,
	zhangjerry@google.com, andrzej.p@collabora.com,
	plr.vincent@gmail.com, jingx.shen@intel.com,
	john.stultz@linaro.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-usb-owner@vger.kernel.org
Subject: Re: [PATCH] usb: gadget: f_fs: don't free buffer prematurely
Date: Wed, 20 Mar 2019 09:01:05 +0530	[thread overview]
Message-ID: <f382765c6d30972ab84224a1b3982f62@codeaurora.org> (raw)
In-Reply-To: <1553037915-85931-1-git-send-email-fei.yang@intel.com>

On 2019-03-20 04:55, fei.yang@intel.com wrote:
> From: Fei Yang <fei.yang@intel.com>
> 
> The following kernel panic happens due to the io_data buffer gets 
> deallocated
> before the async io is completed. Add a check for the case where 
> io_data buffer
> should be deallocated by ffs_user_copy_worker.

[snip]

Please add tag - 'Fixes: 772a7a724f6 ("usb: gadget: f_fs: Allow 
scatter-gather buffers")


> ---
>  drivers/usb/gadget/function/f_fs.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/function/f_fs.c
> b/drivers/usb/gadget/function/f_fs.c
> index 20413c2..47be961 100644
> --- a/drivers/usb/gadget/function/f_fs.c
> +++ b/drivers/usb/gadget/function/f_fs.c
> @@ -1133,7 +1133,8 @@ static ssize_t ffs_epfile_io(struct file *file,
> struct ffs_io_data *io_data)
>  error_mutex:
>  	mutex_unlock(&epfile->mutex);
>  error:
> -	ffs_free_buffer(io_data);
> +	if (ret != -EIOCBQUEUED) /* don't free if there is iocb queued */
> +		ffs_free_buffer(io_data);
>  	return ret;
>  }

  parent reply	other threads:[~2019-03-20  3:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-19 23:25 fei.yang
2019-03-19 23:41 ` John Stultz
2019-03-20  0:09 ` John Stultz
2019-03-20  3:31 ` mgautam [this message]
2019-03-20  5:38   ` Yang, Fei

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=f382765c6d30972ab84224a1b3982f62@codeaurora.org \
    --to=mgautam@codeaurora.org \
    --cc=andrzej.p@collabora.com \
    --cc=balbi@kernel.org \
    --cc=fei.yang@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jingx.shen@intel.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-owner@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=plr.vincent@gmail.com \
    --cc=zhangjerry@google.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®