From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dominique Martinet Subject: Re: KASAN: invalid-free in p9stat_free Date: Tue, 28 Aug 2018 00:40:37 +0200 Message-ID: <20180827224037.GA18923@nautica> References: <000000000000af648b057456e234@google.com> <20180827052412.GA26294@nautica> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: syzbot , David Miller , Eric Van Hensbergen , LKML , Latchesar Ionkov , netdev , syzkaller-bugs , v9fs-developer@lists.sourceforge.net To: Dmitry Vyukov Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org 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