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

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

 



Trond Myklebust <[email protected]> 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-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