From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Mark Salyzyn <salyzyn@android.com>
Cc: linux-kernel@vger.kernel.org, kernel-team@android.com, "Yavuz,
Tuba" <tuba@ece.ufl.edu>,
Felipe Balbi <felipe.balbi@linux.intel.com>,
stable <stable@vger.kernel.org>, Felipe Balbi <balbi@ti.com>,
linux-usb@vger.kernel.org
Subject: Re: USB: gadget: f_midi: fixing a possible double-free in f_midi
Date: Tue, 20 Aug 2019 13:15:15 -0700 [thread overview]
Message-ID: <20190820201515.GA20068@kroah.com> (raw)
In-Reply-To: <20190820174516.255420-1-salyzyn@android.com>
On Tue, Aug 20, 2019 at 10:45:13AM -0700, Mark Salyzyn wrote:
> From: "Yavuz, Tuba" <tuba@ece.ufl.edu>
>
> cherry pick from commit 7fafcfdf6377b18b2a726ea554d6e593ba44349f
> ("USB: gadget: f_midi: fixing a possible double-free in f_midi")
> Removing 'return err;' from conflict.
>
> It looks like there is a possibility of a double-free vulnerability on an
> error path of the f_midi_set_alt function in the f_midi driver. If the
> path is feasible then free_ep_req gets called twice:
>
> req->complete = f_midi_complete;
> err = usb_ep_queue(midi->out_ep, req, GFP_ATOMIC);
> => ...
> usb_gadget_giveback_request
> =>
> f_midi_complete (CALLBACK)
> (inside f_midi_complete, for various cases of status)
> free_ep_req(ep, req); // first kfree
> if (err) {
> ERROR(midi, "%s: couldn't enqueue request: %d\n",
> midi->out_ep->name, err);
> free_ep_req(midi->out_ep, req); // second kfree
> return err;
> }
>
> The double-free possibility was introduced with commit ad0d1a058eac
> ("usb: gadget: f_midi: fix leak on failed to enqueue out requests").
>
> Found by MOXCAFE tool.
>
> Signed-off-by: Tuba Yavuz <tuba@ece.ufl.edu>
> Fixes: ad0d1a058eac ("usb: gadget: f_midi: fix leak on failed to enqueue out requests")
> Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
> Cc: stable <stable@vger.kernel.org> # 4.4.y
No signed-off-by from you?
Anyway, this is already in the 4.4.y queue and will be in the next
release.
thanks,
greg k-h
next prev parent reply other threads:[~2019-08-20 20:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-20 17:45 USB: gadget: f_midi: fixing a possible double-free in f_midi Mark Salyzyn
2019-08-20 20:15 ` Greg Kroah-Hartman [this message]
2019-08-20 21:13 ` Mark Salyzyn
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=20190820201515.GA20068@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=balbi@ti.com \
--cc=felipe.balbi@linux.intel.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=salyzyn@android.com \
--cc=stable@vger.kernel.org \
--cc=tuba@ece.ufl.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.