mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Boyer <jwboyer@redhat.com>
To: Alexey ORISHKO <alexey.orishko@stericsson.com>
Cc: Oliver Neukum <oliver@neukum.org>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: cdc_ncm uses stack memory for DMA
Date: Tue, 2 Aug 2011 08:08:16 -0400	[thread overview]
Message-ID: <20110802120815.GE2096@zod.bos.redhat.com> (raw)
In-Reply-To: <2AC7D4AD8BA1C640B4C60C61C8E520153E3DEF668B@EXDCVYMBSTM006.EQ1STM.local>

On Tue, Aug 02, 2011 at 02:00:16PM +0200, Alexey ORISHKO wrote:
> > -----Original Message-----
> > From: linux-usb-owner@vger.kernel.org [mailto:linux-usb-owner@vger.kernel.org]
> > On Behalf Of Josh Boyer
> > Sent: Tuesday, August 02, 2011 1:02 PM
> 
> > 
> > -		err = cdc_ncm_do_request(ctx, &req, &max_datagram_size, 0, NULL,
> > +		err = cdc_ncm_do_request(ctx, &req, max_datagram_size, 0, NULL,
> >  									1000);
> > +
> >  		if (err) {
> >  			pr_debug("GET_MAX_DATAGRAM_SIZE failed, use size=%u\n",
> >  						CDC_NCM_MIN_DATAGRAM_SIZE);
> 
> You miss to free it here.

Ah, yes.  Will fix it.

> 
> >  		} else {
> > -			ctx->max_datagram_size = le16_to_cpu(max_datagram_size);
> > +			ctx->max_datagram_size = le16_to_cpu(*max_datagram_size);
> >  			/* Check Eth descriptor value */
> >  			if (eth_max_sz < CDC_NCM_MAX_DATAGRAM_SIZE) {
> >  				if (ctx->max_datagram_size > eth_max_sz)
> > @@ -401,10 +423,12 @@ static u8 cdc_ncm_setup(struct cdc_ncm_ctx *ctx)
> >  			req.wValue = 0;
> >  			req.wIndex = cpu_to_le16(iface_no);
> >  			req.wLength = 2;
> > -			max_datagram_size = cpu_to_le16(ctx->max_datagram_size);
> > +			*max_datagram_size = cpu_to_le16(ctx->max_datagram_size);
> > 
> > -			err = cdc_ncm_do_request(ctx, &req, &max_datagram_size,
> > +			err = cdc_ncm_do_request(ctx, &req, max_datagram_size,
> >  								0, NULL, 1000);
> > +			kfree(max_datagram_size);
> > +max_dgram_err:
> >  			if (err)
> >  				pr_debug("SET_MAX_DATAGRAM_SIZE failed\n");
> >  		}
> > --
> 
> 
> You have mem leak in case of request failure. Will you resubmit it with this change?

Yes.

> I have HW available and can test this patch on Ubuntu 11.04.

Great!

josh

      reply	other threads:[~2011-08-02 12:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-01 19:59 Josh Boyer
2011-08-01 20:26 ` Oliver Neukum
2011-08-02 11:01   ` Josh Boyer
2011-08-02 12:00     ` Alexey ORISHKO
2011-08-02 12:08       ` Josh Boyer [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=20110802120815.GE2096@zod.bos.redhat.com \
    --to=jwboyer@redhat.com \
    --cc=alexey.orishko@stericsson.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=oliver@neukum.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®