Re: [PATCH] release_resource() check for NULL resource

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 05, 2005 at 12:31:07AM +0200, Bodo Eggert wrote:
> Pekka Enberg <[email protected]> wrote:
> > static int driver_init(void)
> > {
> >      dev->resource1 = request_region(...);
> >      if (!dev->resource1)
> >              goto failed;
> 
> > failed:
> >      driver_release(dev);
> 
> > static void driver_release(struct device * dev)
> > {
> >      release_resource(dev->resource1);
> >      release_resource(dev->resource2);
> 
> If the dev struct* isn't properly initialized, it will try to free a random
> resource.

Fur christ sake, I've made this point several times in this thread and
it still seems to be missed.  (or maybe it's just folks sloppy use of
English.)

release_resource does *not* free anything.  It unregisters it from the
resource tree _only_.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux