diff options
Diffstat (limited to 'ipc/mqueue.c')
-rw-r--r-- | ipc/mqueue.c | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 9a08acc9e649..6d255e535d03 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
@@ -944,7 +944,7 @@ SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr, | |||
944 | size_t, msg_len, unsigned int, msg_prio, | 944 | size_t, msg_len, unsigned int, msg_prio, |
945 | const struct timespec __user *, u_abs_timeout) | 945 | const struct timespec __user *, u_abs_timeout) |
946 | { | 946 | { |
947 | struct file *filp; | 947 | struct fd f; |
948 | struct inode *inode; | 948 | struct inode *inode; |
949 | struct ext_wait_queue wait; | 949 | struct ext_wait_queue wait; |
950 | struct ext_wait_queue *receiver; | 950 | struct ext_wait_queue *receiver; |
@@ -967,21 +967,21 @@ SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr, | |||
967 | 967 | ||
968 | audit_mq_sendrecv(mqdes, msg_len, msg_prio, timeout ? &ts : NULL); | 968 | audit_mq_sendrecv(mqdes, msg_len, msg_prio, timeout ? &ts : NULL); |
969 | 969 | ||
970 | filp = fget(mqdes); | 970 | f = fdget(mqdes); |
971 | if (unlikely(!filp)) { | 971 | if (unlikely(!f.file)) { |
972 | ret = -EBADF; | 972 | ret = -EBADF; |
973 | goto out; | 973 | goto out; |
974 | } | 974 | } |
975 | 975 | ||
976 | inode = filp->f_path.dentry->d_inode; | 976 | inode = f.file->f_path.dentry->d_inode; |
977 | if (unlikely(filp->f_op != &mqueue_file_operations)) { | 977 | if (unlikely(f.file->f_op != &mqueue_file_operations)) { |
978 | ret = -EBADF; | 978 | ret = -EBADF; |
979 | goto out_fput; | 979 | goto out_fput; |
980 | } | 980 | } |
981 | info = MQUEUE_I(inode); | 981 | info = MQUEUE_I(inode); |
982 | audit_inode(NULL, filp->f_path.dentry); | 982 | audit_inode(NULL, f.file->f_path.dentry); |
983 | 983 | ||
984 | if (unlikely(!(filp->f_mode & FMODE_WRITE))) { | 984 | if (unlikely(!(f.file->f_mode & FMODE_WRITE))) { |
985 | ret = -EBADF; | 985 | ret = -EBADF; |
986 | goto out_fput; | 986 | goto out_fput; |
987 | } | 987 | } |
@@ -1023,7 +1023,7 @@ SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr, | |||
1023 | } | 1023 | } |
1024 | 1024 | ||
1025 | if (info->attr.mq_curmsgs == info->attr.mq_maxmsg) { | 1025 | if (info->attr.mq_curmsgs == info->attr.mq_maxmsg) { |
1026 | if (filp->f_flags & O_NONBLOCK) { | 1026 | if (f.file->f_flags & O_NONBLOCK) { |
1027 | ret = -EAGAIN; | 1027 | ret = -EAGAIN; |
1028 | } else { | 1028 | } else { |
1029 | wait.task = current; | 1029 | wait.task = current; |
@@ -1056,7 +1056,7 @@ out_free: | |||
1056 | if (ret) | 1056 | if (ret) |
1057 | free_msg(msg_ptr); | 1057 | free_msg(msg_ptr); |
1058 | out_fput: | 1058 | out_fput: |
1059 | fput(filp); | 1059 | fdput(f); |
1060 | out: | 1060 | out: |
1061 | return ret; | 1061 | return ret; |
1062 | } | 1062 | } |
@@ -1067,7 +1067,7 @@ SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr, | |||
1067 | { | 1067 | { |
1068 | ssize_t ret; | 1068 | ssize_t ret; |
1069 | struct msg_msg *msg_ptr; | 1069 | struct msg_msg *msg_ptr; |
1070 | struct file *filp; | 1070 | struct fd f; |
1071 | struct inode *inode; | 1071 | struct inode *inode; |
1072 | struct mqueue_inode_info *info; | 1072 | struct mqueue_inode_info *info; |
1073 | struct ext_wait_queue wait; | 1073 | struct ext_wait_queue wait; |
@@ -1084,21 +1084,21 @@ SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr, | |||
1084 | 1084 | ||
1085 | audit_mq_sendrecv(mqdes, msg_len, 0, timeout ? &ts : NULL); | 1085 | audit_mq_sendrecv(mqdes, msg_len, 0, timeout ? &ts : NULL); |
1086 | 1086 | ||
1087 | filp = fget(mqdes); | 1087 | f = fdget(mqdes); |
1088 | if (unlikely(!filp)) { | 1088 | if (unlikely(!f.file)) { |
1089 | ret = -EBADF; | 1089 | ret = -EBADF; |
1090 | goto out; | 1090 | goto out; |
1091 | } | 1091 | } |
1092 | 1092 | ||
1093 | inode = filp->f_path.dentry->d_inode; | 1093 | inode = f.file->f_path.dentry->d_inode; |
1094 | if (unlikely(filp->f_op != &mqueue_file_operations)) { | 1094 | if (unlikely(f.file->f_op != &mqueue_file_operations)) { |
1095 | ret = -EBADF; | 1095 | ret = -EBADF; |
1096 | goto out_fput; | 1096 | goto out_fput; |
1097 | } | 1097 | } |
1098 | info = MQUEUE_I(inode); | 1098 | info = MQUEUE_I(inode); |
1099 | audit_inode(NULL, filp->f_path.dentry); | 1099 | audit_inode(NULL, f.file->f_path.dentry); |
1100 | 1100 | ||
1101 | if (unlikely(!(filp->f_mode & FMODE_READ))) { | 1101 | if (unlikely(!(f.file->f_mode & FMODE_READ))) { |
1102 | ret = -EBADF; | 1102 | ret = -EBADF; |
1103 | goto out_fput; | 1103 | goto out_fput; |
1104 | } | 1104 | } |
@@ -1130,7 +1130,7 @@ SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr, | |||
1130 | } | 1130 | } |
1131 | 1131 | ||
1132 | if (info->attr.mq_curmsgs == 0) { | 1132 | if (info->attr.mq_curmsgs == 0) { |
1133 | if (filp->f_flags & O_NONBLOCK) { | 1133 | if (f.file->f_flags & O_NONBLOCK) { |
1134 | spin_unlock(&info->lock); | 1134 | spin_unlock(&info->lock); |
1135 | ret = -EAGAIN; | 1135 | ret = -EAGAIN; |
1136 | } else { | 1136 | } else { |
@@ -1160,7 +1160,7 @@ SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr, | |||
1160 | free_msg(msg_ptr); | 1160 | free_msg(msg_ptr); |
1161 | } | 1161 | } |
1162 | out_fput: | 1162 | out_fput: |
1163 | fput(filp); | 1163 | fdput(f); |
1164 | out: | 1164 | out: |
1165 | return ret; | 1165 | return ret; |
1166 | } | 1166 | } |
@@ -1174,7 +1174,7 @@ SYSCALL_DEFINE2(mq_notify, mqd_t, mqdes, | |||
1174 | const struct sigevent __user *, u_notification) | 1174 | const struct sigevent __user *, u_notification) |
1175 | { | 1175 | { |
1176 | int ret; | 1176 | int ret; |
1177 | struct file *filp; | 1177 | struct fd f; |
1178 | struct sock *sock; | 1178 | struct sock *sock; |
1179 | struct inode *inode; | 1179 | struct inode *inode; |
1180 | struct sigevent notification; | 1180 | struct sigevent notification; |
@@ -1220,13 +1220,13 @@ SYSCALL_DEFINE2(mq_notify, mqd_t, mqdes, | |||
1220 | skb_put(nc, NOTIFY_COOKIE_LEN); | 1220 | skb_put(nc, NOTIFY_COOKIE_LEN); |
1221 | /* and attach it to the socket */ | 1221 | /* and attach it to the socket */ |
1222 | retry: | 1222 | retry: |
1223 | filp = fget(notification.sigev_signo); | 1223 | f = fdget(notification.sigev_signo); |
1224 | if (!filp) { | 1224 | if (!f.file) { |
1225 | ret = -EBADF; | 1225 | ret = -EBADF; |
1226 | goto out; | 1226 | goto out; |
1227 | } | 1227 | } |
1228 | sock = netlink_getsockbyfilp(filp); | 1228 | sock = netlink_getsockbyfilp(f.file); |
1229 | fput(filp); | 1229 | fdput(f); |
1230 | if (IS_ERR(sock)) { | 1230 | if (IS_ERR(sock)) { |
1231 | ret = PTR_ERR(sock); | 1231 | ret = PTR_ERR(sock); |
1232 | sock = NULL; | 1232 | sock = NULL; |
@@ -1245,14 +1245,14 @@ retry: | |||
1245 | } | 1245 | } |
1246 | } | 1246 | } |
1247 | 1247 | ||
1248 | filp = fget(mqdes); | 1248 | f = fdget(mqdes); |
1249 | if (!filp) { | 1249 | if (!f.file) { |
1250 | ret = -EBADF; | 1250 | ret = -EBADF; |
1251 | goto out; | 1251 | goto out; |
1252 | } | 1252 | } |
1253 | 1253 | ||
1254 | inode = filp->f_path.dentry->d_inode; | 1254 | inode = f.file->f_path.dentry->d_inode; |
1255 | if (unlikely(filp->f_op != &mqueue_file_operations)) { | 1255 | if (unlikely(f.file->f_op != &mqueue_file_operations)) { |
1256 | ret = -EBADF; | 1256 | ret = -EBADF; |
1257 | goto out_fput; | 1257 | goto out_fput; |
1258 | } | 1258 | } |
@@ -1292,7 +1292,7 @@ retry: | |||
1292 | } | 1292 | } |
1293 | spin_unlock(&info->lock); | 1293 | spin_unlock(&info->lock); |
1294 | out_fput: | 1294 | out_fput: |
1295 | fput(filp); | 1295 | fdput(f); |
1296 | out: | 1296 | out: |
1297 | if (sock) { | 1297 | if (sock) { |
1298 | netlink_detachskb(sock, nc); | 1298 | netlink_detachskb(sock, nc); |
@@ -1308,7 +1308,7 @@ SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes, | |||
1308 | { | 1308 | { |
1309 | int ret; | 1309 | int ret; |
1310 | struct mq_attr mqstat, omqstat; | 1310 | struct mq_attr mqstat, omqstat; |
1311 | struct file *filp; | 1311 | struct fd f; |
1312 | struct inode *inode; | 1312 | struct inode *inode; |
1313 | struct mqueue_inode_info *info; | 1313 | struct mqueue_inode_info *info; |
1314 | 1314 | ||
@@ -1319,14 +1319,14 @@ SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes, | |||
1319 | return -EINVAL; | 1319 | return -EINVAL; |
1320 | } | 1320 | } |
1321 | 1321 | ||
1322 | filp = fget(mqdes); | 1322 | f = fdget(mqdes); |
1323 | if (!filp) { | 1323 | if (!f.file) { |
1324 | ret = -EBADF; | 1324 | ret = -EBADF; |
1325 | goto out; | 1325 | goto out; |
1326 | } | 1326 | } |
1327 | 1327 | ||
1328 | inode = filp->f_path.dentry->d_inode; | 1328 | inode = f.file->f_path.dentry->d_inode; |
1329 | if (unlikely(filp->f_op != &mqueue_file_operations)) { | 1329 | if (unlikely(f.file->f_op != &mqueue_file_operations)) { |
1330 | ret = -EBADF; | 1330 | ret = -EBADF; |
1331 | goto out_fput; | 1331 | goto out_fput; |
1332 | } | 1332 | } |
@@ -1335,15 +1335,15 @@ SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes, | |||
1335 | spin_lock(&info->lock); | 1335 | spin_lock(&info->lock); |
1336 | 1336 | ||
1337 | omqstat = info->attr; | 1337 | omqstat = info->attr; |
1338 | omqstat.mq_flags = filp->f_flags & O_NONBLOCK; | 1338 | omqstat.mq_flags = f.file->f_flags & O_NONBLOCK; |
1339 | if (u_mqstat) { | 1339 | if (u_mqstat) { |
1340 | audit_mq_getsetattr(mqdes, &mqstat); | 1340 | audit_mq_getsetattr(mqdes, &mqstat); |
1341 | spin_lock(&filp->f_lock); | 1341 | spin_lock(&f.file->f_lock); |
1342 | if (mqstat.mq_flags & O_NONBLOCK) | 1342 | if (mqstat.mq_flags & O_NONBLOCK) |
1343 | filp->f_flags |= O_NONBLOCK; | 1343 | f.file->f_flags |= O_NONBLOCK; |
1344 | else | 1344 | else |
1345 | filp->f_flags &= ~O_NONBLOCK; | 1345 | f.file->f_flags &= ~O_NONBLOCK; |
1346 | spin_unlock(&filp->f_lock); | 1346 | spin_unlock(&f.file->f_lock); |
1347 | 1347 | ||
1348 | inode->i_atime = inode->i_ctime = CURRENT_TIME; | 1348 | inode->i_atime = inode->i_ctime = CURRENT_TIME; |
1349 | } | 1349 | } |
@@ -1356,7 +1356,7 @@ SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes, | |||
1356 | ret = -EFAULT; | 1356 | ret = -EFAULT; |
1357 | 1357 | ||
1358 | out_fput: | 1358 | out_fput: |
1359 | fput(filp); | 1359 | fdput(f); |
1360 | out: | 1360 | out: |
1361 | return ret; | 1361 | return ret; |
1362 | } | 1362 | } |