Re: [PATCH 1/2] staging: ion: Add ion-physmem driver

From: Greg Kroah-Hartman
Date: Tue Apr 07 2015 - 04:57:18 EST


On Tue, Apr 07, 2015 at 10:35:45AM +0200, Paul Bolle wrote:
> > + ipdev->heap = ion_heap_create(&ipdev->data);
> > + if (!ipdev->heap)
> > + goto errfreeipdev;
> > +
> > + if (!try_module_get(THIS_MODULE))
> > + goto errfreeheap;
>
> For built-in only code THIS_MODULE will be, basically, always NULL. So,
> I think try_module_get() will always return true.

Even if this is a module, this code is racy and broken, no module should
_ever_ call try_module_get(THIS_MODULE). That's a sign of broken code,
and/or a broken API.

thanks,

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