On Tue, Aug 29, 2017 at 09:23:49PM +0200, Christophe JAILLET wrote: > The .release function of driver_ktype is 'driver_release()'. > This function frees the container_of this kobject. > > So, this memory must not be freed explicitly in the error handling path of > 'bus_add_driver()'. Otherwise a double free will occur. Oh, nice catch! > > Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx> > --- > I have left the 'drv->p = NULL' even if it looks useless to me. It does not > hurt. I have also left a comment to explain why we do not free 'drv->p' > explicitly before zeroing this pointer. We need that for when people do static structures. Like as is done for drivers. Well, I think that's why we need it, can't really remember, might as well be safe, the error handling paths here are crazy at times... thnaks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html