]> git.baikalelectronics.ru Git - kernel.git/commit
locks: close potential race in lease_get_mtime
authorJeff Layton <jlayton@primarydata.com>
Fri, 22 Aug 2014 14:18:44 +0000 (10:18 -0400)
committerJeff Layton <jlayton@primarydata.com>
Tue, 7 Oct 2014 18:06:12 +0000 (14:06 -0400)
commit4b5bd66e3e4f390b668ec503dee5f1856251b67d
tree17b28bd50fd22ae65f90e9bd09cc5b14415a0049
parent3e6bd09fcd5e5381a749b7d0793c521feeb01a5b
locks: close potential race in lease_get_mtime

lease_get_mtime is called without the i_lock held, so there's no
guarantee about the stability of the list. Between the time when we
assign "flock" and then dereference it to check whether it's a lease
and for write, the lease could be freed.

Ensure that that doesn't occur by taking the i_lock before trying
to check the lease.

Cc: J. Bruce Fields <bfields@fieldses.org>
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/locks.c