Re: fs/locks.c: Fix sys_flock() race

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

 



Trond Myklebust <Trond.Myklebust@xxxxxxxxxx> wrote:
>
> -	unlock_kernel();
>  
> -	if (new_fl->fl_type == F_UNLCK)
> -		return 0;
> +	if (request->fl_type == F_UNLCK)
> +		goto out;
>  
> +	new_fl = locks_alloc_lock();
> +	if (new_fl == NULL)
> +		goto out;
>  	/*
>  	 * If a higher-priority process was blocked on the old file lock,
>  	 * give it the opportunity to lock the file.
> @@ -769,26 +772,27 @@ static int flock_lock_file(struct file *
>  	if (found)
>  		cond_resched();
>  
> -	lock_kernel();

hm, you've extended lock_kernel() coverage (why?  Does this help fix the
race??) but we still have a cond_resched() inside the now-newly-locked
region.  If that cond_resched() drops the bkl, is the race reopened?
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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