On Tue, 8 Sep 2015, Dmitry Vyukov wrote: > Yes, this is a case of use-after-free bug. But the use-after-free can > happen only due to memory access reordering in a multithreaded > environment. > OK, here is a simpler code snippet: > > void *p; // = NULL > > // thread 1 > p = kmalloc(8); > > // thread 2 > void *r = READ_ONCE(p); > if (r != NULL) > kfree(r); > > I would expect that this is illegal code. Is my understanding correct? This should work. It could be a problem if thread 1 is touching the object. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>