switch alloc_file() to passing struct path
... and have the caller grab both mnt and dentry; kill leak in infiniband, while we are at it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
10
ipc/shm.c
10
ipc/shm.c
@ -878,8 +878,8 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
|
||||
if (err)
|
||||
goto out_unlock;
|
||||
|
||||
path.dentry = dget(shp->shm_file->f_path.dentry);
|
||||
path.mnt = shp->shm_file->f_path.mnt;
|
||||
path = shp->shm_file->f_path;
|
||||
path_get(&path);
|
||||
shp->shm_nattch++;
|
||||
size = i_size_read(path.dentry->d_inode);
|
||||
shm_unlock(shp);
|
||||
@ -889,8 +889,8 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
|
||||
if (!sfd)
|
||||
goto out_put_dentry;
|
||||
|
||||
file = alloc_file(path.mnt, path.dentry, f_mode,
|
||||
is_file_hugepages(shp->shm_file) ?
|
||||
file = alloc_file(&path, f_mode,
|
||||
is_file_hugepages(shp->shm_file) ?
|
||||
&shm_file_operations_huge :
|
||||
&shm_file_operations);
|
||||
if (!file)
|
||||
@ -950,7 +950,7 @@ out_unlock:
|
||||
out_free:
|
||||
kfree(sfd);
|
||||
out_put_dentry:
|
||||
dput(path.dentry);
|
||||
path_put(&path);
|
||||
goto out_nattch;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user