aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/mqueue.c
diff options
context:
space:
mode:
Diffstat (limited to 'ipc/mqueue.c')
-rw-r--r--ipc/mqueue.c86
1 files changed, 44 insertions, 42 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index a808f29d4c5a..c0d58f390c3b 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -691,7 +691,7 @@ static void __do_notify(struct mqueue_inode_info *info)
691 wake_up(&info->wait_q); 691 wake_up(&info->wait_q);
692} 692}
693 693
694static int prepare_timeout(const struct timespec __user *u_abs_timeout, 694static int prepare_timeout(const struct __kernel_timespec __user *u_abs_timeout,
695 struct timespec64 *ts) 695 struct timespec64 *ts)
696{ 696{
697 if (get_timespec64(ts, u_abs_timeout)) 697 if (get_timespec64(ts, u_abs_timeout))
@@ -1128,7 +1128,7 @@ out:
1128 1128
1129SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr, 1129SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr,
1130 size_t, msg_len, unsigned int, msg_prio, 1130 size_t, msg_len, unsigned int, msg_prio,
1131 const struct timespec __user *, u_abs_timeout) 1131 const struct __kernel_timespec __user *, u_abs_timeout)
1132{ 1132{
1133 struct timespec64 ts, *p = NULL; 1133 struct timespec64 ts, *p = NULL;
1134 if (u_abs_timeout) { 1134 if (u_abs_timeout) {
@@ -1142,7 +1142,7 @@ SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr,
1142 1142
1143SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr, 1143SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr,
1144 size_t, msg_len, unsigned int __user *, u_msg_prio, 1144 size_t, msg_len, unsigned int __user *, u_msg_prio,
1145 const struct timespec __user *, u_abs_timeout) 1145 const struct __kernel_timespec __user *, u_abs_timeout)
1146{ 1146{
1147 struct timespec64 ts, *p = NULL; 1147 struct timespec64 ts, *p = NULL;
1148 if (u_abs_timeout) { 1148 if (u_abs_timeout) {
@@ -1420,6 +1420,47 @@ COMPAT_SYSCALL_DEFINE4(mq_open, const char __user *, u_name,
1420 return do_mq_open(u_name, oflag, mode, p); 1420 return do_mq_open(u_name, oflag, mode, p);
1421} 1421}
1422 1422
1423COMPAT_SYSCALL_DEFINE2(mq_notify, mqd_t, mqdes,
1424 const struct compat_sigevent __user *, u_notification)
1425{
1426 struct sigevent n, *p = NULL;
1427 if (u_notification) {
1428 if (get_compat_sigevent(&n, u_notification))
1429 return -EFAULT;
1430 if (n.sigev_notify == SIGEV_THREAD)
1431 n.sigev_value.sival_ptr = compat_ptr(n.sigev_value.sival_int);
1432 p = &n;
1433 }
1434 return do_mq_notify(mqdes, p);
1435}
1436
1437COMPAT_SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes,
1438 const struct compat_mq_attr __user *, u_mqstat,
1439 struct compat_mq_attr __user *, u_omqstat)
1440{
1441 int ret;
1442 struct mq_attr mqstat, omqstat;
1443 struct mq_attr *new = NULL, *old = NULL;
1444
1445 if (u_mqstat) {
1446 new = &mqstat;
1447 if (get_compat_mq_attr(new, u_mqstat))
1448 return -EFAULT;
1449 }
1450 if (u_omqstat)
1451 old = &omqstat;
1452
1453 ret = do_mq_getsetattr(mqdes, new, old);
1454 if (ret || !old)
1455 return ret;
1456
1457 if (put_compat_mq_attr(old, u_omqstat))
1458 return -EFAULT;
1459 return 0;
1460}
1461#endif
1462
1463#ifdef CONFIG_COMPAT_32BIT_TIME
1423static int compat_prepare_timeout(const struct compat_timespec __user *p, 1464static int compat_prepare_timeout(const struct compat_timespec __user *p,
1424 struct timespec64 *ts) 1465 struct timespec64 *ts)
1425{ 1466{
@@ -1459,45 +1500,6 @@ COMPAT_SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes,
1459 } 1500 }
1460 return do_mq_timedreceive(mqdes, u_msg_ptr, msg_len, u_msg_prio, p); 1501 return do_mq_timedreceive(mqdes, u_msg_ptr, msg_len, u_msg_prio, p);
1461} 1502}
1462
1463COMPAT_SYSCALL_DEFINE2(mq_notify, mqd_t, mqdes,
1464 const struct compat_sigevent __user *, u_notification)
1465{
1466 struct sigevent n, *p = NULL;
1467 if (u_notification) {
1468 if (get_compat_sigevent(&n, u_notification))
1469 return -EFAULT;
1470 if (n.sigev_notify == SIGEV_THREAD)
1471 n.sigev_value.sival_ptr = compat_ptr(n.sigev_value.sival_int);
1472 p = &n;
1473 }
1474 return do_mq_notify(mqdes, p);
1475}
1476
1477COMPAT_SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes,
1478 const struct compat_mq_attr __user *, u_mqstat,
1479 struct compat_mq_attr __user *, u_omqstat)
1480{
1481 int ret;
1482 struct mq_attr mqstat, omqstat;
1483 struct mq_attr *new = NULL, *old = NULL;
1484
1485 if (u_mqstat) {
1486 new = &mqstat;
1487 if (get_compat_mq_attr(new, u_mqstat))
1488 return -EFAULT;
1489 }
1490 if (u_omqstat)
1491 old = &omqstat;
1492
1493 ret = do_mq_getsetattr(mqdes, new, old);
1494 if (ret || !old)
1495 return ret;
1496
1497 if (put_compat_mq_attr(old, u_omqstat))
1498 return -EFAULT;
1499 return 0;
1500}
1501#endif 1503#endif
1502 1504
1503static const struct inode_operations mqueue_dir_inode_operations = { 1505static const struct inode_operations mqueue_dir_inode_operations = {