linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Christoph Hellwig <hch@lst.de>,
	Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Andrzej Pietrasiewicz <andrzej.p@samsung.com>,
	Bart Van Assche <bart.vanassche@sandisk.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	target-devel@vger.kernel.org
Subject: Re: [patch -target tree] usb: gadget: f_tcm: use after free
Date: Wed, 02 Mar 2016 13:55:45 +0200	[thread overview]
Message-ID: <87k2ll856m.fsf@ti.com> (raw)
In-Reply-To: <20160302100848.GC5533@mwanda>

[-- Attachment #1: Type: text/plain, Size: 960 bytes --]

Dan Carpenter <dan.carpenter@oracle.com> writes:
> We need to move the kfree() down a line so we don't dereference a freed
> variable.
>
> Fixes: 1b418a8fcbc0 ('target: Convert demo-mode only drivers to target_alloc_session')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

It's okay to take this via target:

Signed-off-by: Felipe Balbi <balbi@kernel.org>

> diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c
> index 7276a73..e352a31 100644
> --- a/drivers/usb/gadget/function/f_tcm.c
> +++ b/drivers/usb/gadget/function/f_tcm.c
> @@ -1596,8 +1596,8 @@ static int tcm_usbg_make_nexus(struct usbg_tpg *tpg, char *name)
>  #define MAKE_NEXUS_MSG "core_tpg_check_initiator_node_acl() failed for %s\n"
>  		pr_debug(MAKE_NEXUS_MSG, name);
>  #undef MAKE_NEXUS_MSG
> -		kfree(tv_nexus);
>  		ret = PTR_ERR(tv_nexus->tvn_se_sess);
> +		kfree(tv_nexus);
>  	}
>  
>  out_unlock:

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

  reply	other threads:[~2016-03-02 11:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-02 10:08 [patch -target tree] usb: gadget: f_tcm: use after free Dan Carpenter
2016-03-02 11:55 ` Felipe Balbi [this message]
2016-03-05  7:26   ` Nicholas A. Bellinger
2016-03-09 11:38     ` Felipe Balbi
2016-03-10  6:23       ` Nicholas A. Bellinger
2016-03-09 12:53     ` Andrzej Pietrasiewicz
2016-03-10  5:19       ` Nicholas A. Bellinger
2016-03-10  8:34         ` Andrzej Pietrasiewicz
2016-03-11  4:10           ` Nicholas A. Bellinger
2016-03-05  7:20 ` Nicholas A. Bellinger

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=87k2ll856m.fsf@ti.com \
    --to=balbi@kernel.org \
    --cc=andrzej.p@samsung.com \
    --cc=bart.vanassche@sandisk.com \
    --cc=bigeasy@linutronix.de \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=nab@linux-iscsi.org \
    --cc=target-devel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).