mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Cc: Felipe Balbi <balbi@kernel.org>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Christoph Hellwig <hch@lst.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	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: Thu, 10 Mar 2016 20:10:16 -0800	[thread overview]
Message-ID: <1457669416.4062.62.camel@haakon3.risingtidesystems.com> (raw)
In-Reply-To: <56E131AA.30107@samsung.com>

On Thu, 2016-03-10 at 09:34 +0100, Andrzej Pietrasiewicz wrote:
> Hi Nicholas,
> 
> W dniu 10.03.2016 o 06:19, Nicholas A. Bellinger pisze:
> > Hi Andrzej,
> >
> > On Wed, 2016-03-09 at 13:53 +0100, Andrzej Pietrasiewicz wrote:
> >> Hi Nicholas,
> >>

<SNIP>

> >
> > Mmmm, usbg_get_cmd() was missing an explicit memset() after tag lookup.
> >
> > How about the following..?
> >
> > diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c
> > index e352a31..d4e8a91 100644
> > --- a/drivers/usb/gadget/function/f_tcm.c
> > +++ b/drivers/usb/gadget/function/f_tcm.c
> > @@ -1078,6 +1078,7 @@ static struct usbg_cmd *usbg_get_cmd(struct f_uas *fu,
> >                  return ERR_PTR(-ENOMEM);
> >
> >          cmd = &((struct usbg_cmd *)se_sess->sess_cmd_map)[tag];
> > +       memset(cmd, 0, sizeof(*cmd));
> >          cmd->se_cmd.map_tag = tag;
> >          cmd->se_cmd.tag = cmd->tag = scsi_tag;
> >          cmd->fu = fu;
> >
> >
> >
> 
> I tested it. Works for me.

Folding this missing memset() into usb-gadget's percpu_ida conversion
for -v4.

Thanks Andrzej!

  reply	other threads:[~2016-03-11  4:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-02 10:08 Dan Carpenter
2016-03-02 11:55 ` Felipe Balbi
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 [this message]
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=1457669416.4062.62.camel@haakon3.risingtidesystems.com \
    --to=nab@linux-iscsi.org \
    --cc=andrzej.p@samsung.com \
    --cc=balbi@kernel.org \
    --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=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

all inboxes | Powered by JetHome®