Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754686Ab0KIUVR (ORCPT ); Tue, 9 Nov 2010 15:21:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:3259 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754589Ab0KIUVO (ORCPT ); Tue, 9 Nov 2010 15:21:14 -0500 Subject: Re: [PATCH] fanotify: correct broken ref counting in case adding a mark failed From: Eric Paris To: Lino Sanfilippo Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org In-Reply-To: <20101109171816.GB14516@lsanfilippo.unix.rd.tt.avira.com> References: <20101109171816.GB14516@lsanfilippo.unix.rd.tt.avira.com> Content-Type: text/plain; charset="UTF-8" Date: Tue, 09 Nov 2010 15:21:11 -0500 Message-ID: <1289334071.3083.29.camel@localhost.localdomain> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1176 Lines: 23 On Tue, 2010-11-09 at 18:18 +0100, Lino Sanfilippo wrote: > If adding a mount or inode mark failed fanotify_free_mark() is called explicitly. > But at this time the mark has already been put into the destroy list of the > fsnotify_mark kernel thread. If the thread is too slow it will try to decrease > the reference of a mark, that has already been freed by fanotify_free_mark(). > (If its fast enough it will only decrease the marks ref counter from 2 to 1 - note > that the counter has been increased to 2 in add_mark() - which has practically no > effect.) > This patch fixes the ref counting by not calling free_mark() explicitly, but > decreasing the ref counter and rely on the fsnotify_mark thread to cleanup in > case adding the mark has failed. > > Signed-off-by: Lino Sanfilippo applied to http://git.infradead.org/users/eparis/notify.git/ #for-next -Eric -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/