linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Connor H <cmdkhh@gmail.com>
To: Andre Bartke <andre.bartke@googlemail.com>
Cc: Michal Nazarewicz <mina86@mina86.com>,
	gregkh@suse.de, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers/usb/gadget: add missing kfree calls
Date: Sat, 4 Jun 2011 18:35:35 -0700	[thread overview]
Message-ID: <BANLkTi=G3gxT0WHham9Yi6SecysGoov68A@mail.gmail.com> (raw)
In-Reply-To: <20110604235449.6a00218c@kvasir>

On Sat, Jun 4, 2011 at 2:54 PM, Andre Bartke
<andre.bartke@googlemail.com> wrote:
> On Sat, 04 Jun 2011 23:35:16 +0200
> "Michal Nazarewicz" <mina86@mina86.com> wrote:
>
>> On Sat, 04 Jun 2011 21:34:54 +0200, Andre Bartke
>> <andre.bartke@googlemail.com> wrote:
>> > diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c
>> > @@ -700,6 +701,7 @@ static int rndis_reset_response(int configNr,
>> > rndis_reset_msg_type *buf)
>> >     resp->AddressingReset = cpu_to_le32(1);
>> >     params->resp_avail(params->v);
>> > +   kfree(r);
>> >     return 0;
>> >  }
>>
>> Have you tested this?  It does not look right to me.
>> rndis_add_response() allocates memory and puts the request on a
>> list.  It is later freed in rndis_free_response().
>>
>
> Nope, the only way I can test this is a build - which it does.
> You might be right though.

building != correct

r is being added to a list in rndis_add_response
Andre is right, rndis_free_response handles list removal

982 if (r && r->buf == buf) {
983                         list_del(&r->list);
984                         kfree(r);
985                 }

in fact all of the kfree calls I believe are incorrect.

Connor

> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

  reply	other threads:[~2011-06-05  1:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-04 19:34 [PATCH] drivers/usb/gadget: add missing kfree calls Andre Bartke
2011-06-04 21:35 ` Michal Nazarewicz
2011-06-04 21:54   ` Andre Bartke
2011-06-05  1:35     ` Connor H [this message]
2011-06-05  9:50       ` Andre Bartke

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='BANLkTi=G3gxT0WHham9Yi6SecysGoov68A@mail.gmail.com' \
    --to=cmdkhh@gmail.com \
    --cc=andre.bartke@googlemail.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mina86@mina86.com \
    /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).