Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751088AbXAFCaF (ORCPT ); Fri, 5 Jan 2007 21:30:05 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751117AbXAFC3D (ORCPT ); Fri, 5 Jan 2007 21:29:03 -0500 Received: from 216-99-217-87.dsl.aracnet.com ([216.99.217.87]:36427 "EHLO sous-sol.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751103AbXAFC2p (ORCPT ); Fri, 5 Jan 2007 21:28:45 -0500 Message-Id: <20070106023240.129725000@sous-sol.org> References: <20070106022753.334962000@sous-sol.org> User-Agent: quilt/0.45-1 Date: Fri, 05 Jan 2007 18:28:13 -0800 From: Chris Wright To: linux-kernel@vger.kernel.org, stable@kernel.org, torvalds@osdl.org Cc: Justin Forbes , Zwane Mwaikambo , "Theodore Ts'o" , Randy Dunlap , Dave Jones , Chuck Wolber , Chris Wedgwood , Michael Krufky , akpm@osdl.org, alan@lxorguk.ukuu.org.uk, hugh@veritas.com, pbadari@us.ibm.com Subject: [patch 20/50] Fix for shmem_truncate_range() BUG_ON() Content-Disposition: inline; filename=fix-for-shmem_truncate_range-bug_on.patch Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1390 Lines: 44 -stable review patch. If anyone has any objections, please let us know. ------------------ From: Badari Pulavarty Ran into BUG() while doing madvise(REMOVE) testing. If we are punching a hole into shared memory segment using madvise(REMOVE) and the entire hole is below the indirect blocks, we hit following assert. BUG_ON(limit <= SHMEM_NR_DIRECT); Signed-off-by: Badari Pulavarty Cc: Hugh Dickins Cc: Signed-off-by: Andrew Morton Signed-off-by: Chris Wright --- mm/shmem.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- linux-2.6.19.1.orig/mm/shmem.c +++ linux-2.6.19.1/mm/shmem.c @@ -515,7 +515,12 @@ static void shmem_truncate_range(struct size = SHMEM_NR_DIRECT; nr_swaps_freed = shmem_free_swp(ptr+idx, ptr+size); } - if (!topdir) + + /* + * If there are no indirect blocks or we are punching a hole + * below indirect blocks, nothing to be done. + */ + if (!topdir || (punch_hole && (limit <= SHMEM_NR_DIRECT))) goto done2; BUG_ON(limit <= SHMEM_NR_DIRECT); -- - 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/