Thread (6 messages) flat view 6 messages, 3 authors, 2018-08-27

Re: KASAN: invalid-free in p9stat_free

From: Dominique Martinet <asmadeus@codewreck.org>
Date: 2018-08-27 22:40:56
Also in: lkml

Dmitry Vyukov wrote on Mon, Aug 27, 2018:
kfree and then null pointer is pretty common, try to run:

find -name "*.c" -exec grep -A 1 "kfree(" {} \; | grep -B 1 " = NULL;"
Hmm, right, it looks like somewhere between 5 and 10% of the kfree()
calls are followed by NULL assignment, that's "common enough" - not
generalized but not rare either.
Leaving dangling pointers behind is not the best idea.
And from what I remember a bunch of similar double frees were fixed by
nulling the pointer after the first kfree.
In this case it really is an error to call p9stat_free again, so let's
just do both.
Will send the patches shortly.


Thanks,
-- 
Dominique
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help