diff options
Diffstat (limited to 'ipc')
| -rw-r--r-- | ipc/shm.c | 13 |
1 files changed, 5 insertions, 8 deletions
| @@ -907,7 +907,7 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr) | |||
| 907 | goto out_unlock; | 907 | goto out_unlock; |
| 908 | 908 | ||
| 909 | path.dentry = dget(shp->shm_file->f_path.dentry); | 909 | path.dentry = dget(shp->shm_file->f_path.dentry); |
| 910 | path.mnt = mntget(shp->shm_file->f_path.mnt); | 910 | path.mnt = shp->shm_file->f_path.mnt; |
| 911 | shp->shm_nattch++; | 911 | shp->shm_nattch++; |
| 912 | size = i_size_read(path.dentry->d_inode); | 912 | size = i_size_read(path.dentry->d_inode); |
| 913 | shm_unlock(shp); | 913 | shm_unlock(shp); |
| @@ -915,18 +915,16 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr) | |||
| 915 | err = -ENOMEM; | 915 | err = -ENOMEM; |
| 916 | sfd = kzalloc(sizeof(*sfd), GFP_KERNEL); | 916 | sfd = kzalloc(sizeof(*sfd), GFP_KERNEL); |
| 917 | if (!sfd) | 917 | if (!sfd) |
| 918 | goto out_put_path; | 918 | goto out_put_dentry; |
| 919 | 919 | ||
| 920 | err = -ENOMEM; | 920 | err = -ENOMEM; |
| 921 | file = get_empty_filp(); | 921 | |
| 922 | file = alloc_file(path.mnt, path.dentry, f_mode, &shm_file_operations); | ||
| 922 | if (!file) | 923 | if (!file) |
| 923 | goto out_free; | 924 | goto out_free; |
| 924 | 925 | ||
| 925 | file->f_op = &shm_file_operations; | ||
| 926 | file->private_data = sfd; | 926 | file->private_data = sfd; |
| 927 | file->f_path = path; | ||
| 928 | file->f_mapping = shp->shm_file->f_mapping; | 927 | file->f_mapping = shp->shm_file->f_mapping; |
| 929 | file->f_mode = f_mode; | ||
| 930 | sfd->id = shp->id; | 928 | sfd->id = shp->id; |
| 931 | sfd->ns = get_ipc_ns(ns); | 929 | sfd->ns = get_ipc_ns(ns); |
| 932 | sfd->file = shp->shm_file; | 930 | sfd->file = shp->shm_file; |
| @@ -977,9 +975,8 @@ out_unlock: | |||
| 977 | 975 | ||
| 978 | out_free: | 976 | out_free: |
| 979 | kfree(sfd); | 977 | kfree(sfd); |
| 980 | out_put_path: | 978 | out_put_dentry: |
| 981 | dput(path.dentry); | 979 | dput(path.dentry); |
| 982 | mntput(path.mnt); | ||
| 983 | goto out_nattch; | 980 | goto out_nattch; |
| 984 | } | 981 | } |
| 985 | 982 | ||
