From: SF Markus Elfring <elfring@users.sourceforge.net>
To: kernel-janitors@vger.kernel.org
Subject: Re: [patch] usb: gadget: f_midi: missing unlock on error path
Date: Tue, 22 Dec 2015 18:22:50 +0000 [thread overview]
Message-ID: <567994FA.5080309@users.sourceforge.net> (raw)
In-Reply-To: <20151221132017.GB27286@mwanda>
> We added a new error path to this function and we forgot to drop the lock.
>
> Fixes: e1e3d7ec5da3 ('usb: gadget: f_midi: pre-allocate IN requests')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
> index fb1fe96d..92b9ec8 100644
> --- a/drivers/usb/gadget/function/f_midi.c
> +++ b/drivers/usb/gadget/function/f_midi.c
> @@ -1213,8 +1213,10 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi)
> midi->in_last_port = 0;
>
> status = kfifo_alloc(&midi->in_req_fifo, midi->qlen, GFP_KERNEL);
> - if (status)
> + if (status) {
> + mutex_unlock(&opts->lock);
> goto setup_fail;
> + }
>
> ++opts->refcnt;
> mutex_unlock(&opts->lock);
How do you think about to move this unlock call and the one that belongs to
the handling of a kstrdup() failure below the shown jump target?
Regards,
Markus
prev parent reply other threads:[~2015-12-22 18:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-21 13:20 [patch] usb: gadget: f_midi: missing unlock on error path Dan Carpenter
2015-12-22 16:51 ` Felipe Ferreri Tonello
2015-12-22 18:22 ` SF Markus Elfring [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=567994FA.5080309@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=kernel-janitors@vger.kernel.org \
/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.