From: Jens Axboe <axboe@kernel.dk>
To: Selvarasu Ganesan <quic_selvaras@quicinc.com>,
Greg KH <gregkh@linuxfoundation.org>
Cc: brauner@kernel.org, jack@suse.cz, jlayton@kernel.org,
keescook@chromium.org, peter@korsgaard.com, hayama@lineo.co.jp,
dmantipov@yandex.ru, quic_linyyuan@quicinc.com,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
quic_ppratap@quicinc.com, quic_wcheng@quicinc.com,
quic_jackp@quicinc.com
Subject: Re: [PATCH] usb: gadget: f_fs: Fix NULL pointer dereference in ffs_epfile_async_io_complete()
Date: Fri, 23 Feb 2024 07:43:08 -0700 [thread overview]
Message-ID: <3cbe7ad1-421a-493c-9cb2-9234e139923f@kernel.dk> (raw)
In-Reply-To: <d2f40e2d-cbbd-41f9-9aa6-41d0f251ffda@quicinc.com>
On 2/23/24 4:35 AM, Selvarasu Ganesan wrote:
> Here?s what the code might look like with a new lock:
>
> static void ffs_epfile_async_io_complete(struct usb_ep *_ep,
> struct usb_request *req)
> {
> ....
> spin_lock(&ffs->new_lock);
> if (ffs && ffs->io_completion_wq)
> queue_work(ffs->io_completion_wq, &io_data->work);
> spin_unlock(&ffs->new_lock);
> ....
> }
>
>
>
> static void ffs_data_put(struct ffs_data *ffs) {
> ...
> destroy_workqueue(ffs->io_completion_wq);
> kfree(ffs->dev_name);
> spin_lock(&ffs->new_lock);
> kfree(ffs);
> spin_unlock(&ffs->new_lock);
> ...
> }
This obviously won't work at all, and it's not the right way to fix it
at all. It needs a ref count.
--
Jens Axboe
prev parent reply other threads:[~2024-02-23 14:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-23 5:48 [PATCH] usb: gadget: f_fs: Fix NULL pointer dereference in ffs_epfile_async_io_complete() Selvarasu Ganesan
2024-02-23 5:58 ` Greg KH
2024-02-23 11:35 ` Selvarasu Ganesan
2024-02-23 12:40 ` Greg KH
2024-02-23 14:43 ` Jens Axboe [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=3cbe7ad1-421a-493c-9cb2-9234e139923f@kernel.dk \
--to=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=dmantipov@yandex.ru \
--cc=gregkh@linuxfoundation.org \
--cc=hayama@lineo.co.jp \
--cc=jack@suse.cz \
--cc=jlayton@kernel.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=peter@korsgaard.com \
--cc=quic_jackp@quicinc.com \
--cc=quic_linyyuan@quicinc.com \
--cc=quic_ppratap@quicinc.com \
--cc=quic_selvaras@quicinc.com \
--cc=quic_wcheng@quicinc.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