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

From: Andrew Morton
Date: Wed Mar 29 2006 - 19:36:10 EST


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-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/