Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S265069AbTHBTpx (ORCPT ); Sat, 2 Aug 2003 15:45:53 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S265531AbTHBTpx (ORCPT ); Sat, 2 Aug 2003 15:45:53 -0400 Received: from fw.osdl.org ([65.172.181.6]:59833 "EHLO mail.osdl.org") by vger.kernel.org with ESMTP id S265069AbTHBTpv (ORCPT ); Sat, 2 Aug 2003 15:45:51 -0400 Date: Sat, 2 Aug 2003 12:46:47 -0700 From: Andrew Morton To: Matt Mackall Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH] [1/2] random: SMP locking Message-Id: <20030802124647.62ad775f.akpm@osdl.org> In-Reply-To: <20030802193306.GK22824@waste.org> References: <20030802042445.GD22824@waste.org> <20030802040015.0fcafda2.akpm@osdl.org> <20030802143222.GG22824@waste.org> <20030802120023.7390f68f.akpm@osdl.org> <20030802193306.GK22824@waste.org> X-Mailer: Sylpheed version 0.9.4 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 787 Lines: 30 Matt Mackall wrote: > > + spin_lock(&random_state->lock); > + ent_count = random_state->entropy_count; > + memcpy(tmp, random_state->pool, size * sizeof(__u32)); > + spin_unlock(&random_state->lock); > + This needs to be spin_lock_irqsave(). > + if (!copy_to_user(p, tmp, size * sizeof(__u32))) { > + kfree(tmp); > + goto fail; > + } > + > + kfree(tmp); > + > + if(put_user(ent_count, p++)) > + goto fail; > + > return 0; > + fail: > + spin_unlock(&random_state->lock); Double unlock ;) - 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/