Re: [PATCH] pidfs: detect refcount bugs

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

 



I am traveling until May 15, can't read the code, but FWIW this change
looks good to me.

Oleg.

On 05/06, Christian Brauner wrote:
>
> Now that we have pidfs_{get,register}_pid() that needs to be paired with
> pidfs_put_pid() it's possible that someone pairs them with put_pid().
> Thus freeing struct pid while it's still used by pidfs. Notice when that
> happens. I'll also add a scheme to detect invalid uses of
> pidfs_get_pid() and pidfs_put_pid() later.
> 
> Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx>
> ---
>  kernel/pid.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/pid.c b/kernel/pid.c
> index 26f1e136f017..8317bcbc7cf7 100644
> --- a/kernel/pid.c
> +++ b/kernel/pid.c
> @@ -100,6 +100,7 @@ void put_pid(struct pid *pid)
>  
>  	ns = pid->numbers[pid->level].ns;
>  	if (refcount_dec_and_test(&pid->count)) {
> +		WARN_ON_ONCE(pid->stashed);
>  		kmem_cache_free(ns->pid_cachep, pid);
>  		put_pid_ns(ns);
>  	}
> -- 
> 2.47.2
> 





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux