Re: [PATCH] pidhash: Refactor the pid hash table.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[email protected] (Eric W. Biederman) wrote:
>
> +fastcall void put_pid(struct pid *pid)
> +{
> +	if (!pid)
> +		return;
> +	if ((atomic_read(&pid->count) == 1) ||
> +	     atomic_dec_and_test(&pid->count))
> +		kmem_cache_free(pid_cachep, pid);
> +}

This looks odd.  It's an RCU callback so it's asynchronous.  It doesn't
take any locks, so if anyone else can have a ref on this thing then the
refcount can change at any time.

And both sides of the || are basically equivalent.  Perhaps you meant &&. 
But I'm more worried by the apparent raciness?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux