don't bother with {get,put}_write_access() on non-regular files

it's pointless and actually leads to wrong behaviour in at least one
moderately convoluted case (pipe(), close one end, try to get to
another via /proc/*/fd and run into ETXTBUSY).

Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2014-03-14 10:56:20 -04:00
parent 44ba8406d0
commit dd20908a8a
2 changed files with 9 additions and 21 deletions

View file

@ -209,10 +209,10 @@ static void drop_file_write_access(struct file *file)
struct dentry *dentry = file->f_path.dentry;
struct inode *inode = dentry->d_inode;
put_write_access(inode);
if (special_file(inode->i_mode))
return;
put_write_access(inode);
if (file_check_writeable(file) != 0)
return;
__mnt_drop_write(mnt);