Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261824AbVD0RTw (ORCPT ); Wed, 27 Apr 2005 13:19:52 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261821AbVD0RS6 (ORCPT ); Wed, 27 Apr 2005 13:18:58 -0400 Received: from mail.kroah.org ([69.55.234.183]:25542 "EHLO perch.kroah.org") by vger.kernel.org with ESMTP id S261810AbVD0RRl (ORCPT ); Wed, 27 Apr 2005 13:17:41 -0400 Date: Wed, 27 Apr 2005 10:16:39 -0700 From: Greg KH To: jjaakkol@cs.Helsinki.FI, dhowells@redhat.com Cc: linux-kernel@vger.kernel.org, stable@kernel.org, Justin Forbes , Zwane Mwaikambo , Cliff White , "Theodore Ts'o" , "Randy.Dunlap" , Chuck Wolber , torvalds@osdl.org, akpm@osdl.org, alan@lxorguk.ukuu.org.uk Subject: [05/07] [PATCH] Fix reproducible SMP crash in security/keys/key.c Message-ID: <20050427171639.GF3195@kroah.com> References: <20050427171446.GA3195@kroah.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050427171446.GA3195@kroah.com> User-Agent: Mutt/1.5.8i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1911 Lines: 54 -stable review patch. If anyone has any objections, please let us know. ------------------ Jani Jaakkola wrote: > > SMP race handling is broken in key_user_lookup() in security/keys/key.c This was fixed post-2.6.11. Can you confirm that 2.6.12-rc2 works OK? This is the patch we used. It should go into -stable if it's not already there. From: Alexander Nyberg I looked at some of the oops reports against keyrings, I think the problem is that the search isn't restarted after dropping the key_user_lock, *p will still be NULL when we get back to try_again and look through the tree. It looks like the intention was that the search start over from scratch. Signed-off-by: Alexander Nyberg Cc: David Howells Signed-off-by: Andrew Morton Signed-off-by: Chris Wright Signed-off-by: Greg Kroah-Hartman --- 25-akpm/security/keys/key.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) diff -puN security/keys/key.c~race-against-parent-deletion-in-key_user_lookup security/keys/key.c --- 25/security/keys/key.c~race-against-parent-deletion-in-key_user_lookup 2005-03-10 00:38:38.000000000 -0800 +++ 25-akpm/security/keys/key.c 2005-03-10 00:38:38.000000000 -0800 @@ -57,9 +57,10 @@ struct key_user *key_user_lookup(uid_t u { struct key_user *candidate = NULL, *user; struct rb_node *parent = NULL; - struct rb_node **p = &key_user_tree.rb_node; + struct rb_node **p; try_again: + p = &key_user_tree.rb_node; spin_lock(&key_user_lock); /* search the tree for a user record with a matching UID */ _ - 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/