On Thu, Aug 15, 2019 at 12:35:26PM +0200, Knut Omang wrote: > On Thu, 2019-08-15 at 10:49 +0200, Greg Kroah-Hartman wrote: > > > I perfectly agree with you that reducing the hole for a race condition > > > is generally a bad idea, but from the above mail thread > > > it seems that's the only available choice for older kernels? > > > > I have no idea, but please, do not use that pattern of code as it is > > racy in all kernels, from all of time. > > Ok, will remove it :-) > > I tried in vain to find the commit from Al Viro that made the code safe, > to identify which kernels that are safe from this issue, > but he has a **lot** of commits, do you have a clue for what/where to look? > > It will be good to have a mention/comment on this for future reference, > like the earliest kernel version where this is safe. Always use a "newer" kernel to be "safe" and you will be fine :) > Maybe we can even get rid of some more of the remaining of these too.. > (I notice there's 65 cases of 'if (!try_module_get(THIS_MODULE))' > right now) Something to put on a TODO list somewhere... thanks, greg k-h