lkml.org 
[lkml]   [2003]   [Aug]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] [1/2] random: SMP locking
Matt Mackall <mpm@selenic.com> 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/

\
 
 \ /
  Last update: 2005-03-22 13:47    [W:0.042 / U:0.816 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site