[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110328175448.GR2526@redhat.com>
Date: Mon, 28 Mar 2011 13:54:48 -0400
From: Aristeu Rozanski <aris@...hat.com>
To: Steven Hardy <shardy@...hat.com>
Cc: gregkh@...e.de, mjg@...hat.com, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [GIT PATCH] Fix memory leak in qcserial driver
On Mon, Mar 28, 2011 at 06:48:11PM +0100, Steven Hardy wrote:
> On Mon, Mar 28, 2011 at 01:34:24PM -0400, Aristeu Rozanski wrote:
> > > + usb_set_serial_data(serial, data);
> > > return retval;
> > > }
> > when there's a -ENODEV, kfree() is called but the now invalid address is
> > set by usb_set_serial_data() anyway. am I missing something here?
>
> The intention here is that since data should be NULL after the kfree, we're simply setting serial->private to NULL.
kfree(data) won't make data == NULL. it'll free whatever address data
has. data will still have the same (now stale) address. you need to
explicitely make data = NULL if you want that behavior.
--
Aristeu
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists