summaryrefslogtreecommitdiff
path: root/ipc
diff options
context:
space:
mode:
Diffstat (limited to 'ipc')
-rw-r--r--ipc/mqueue.c39
-rw-r--r--ipc/msg.c23
-rw-r--r--ipc/msgutil.c3
-rw-r--r--ipc/sem.c10
-rw-r--r--ipc/shm.c8
5 files changed, 17 insertions, 66 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 4f7d959..71a3ca1 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -330,16 +330,8 @@ static struct dentry *mqueue_mount(struct file_system_type *fs_type,
int flags, const char *dev_name,
void *data)
{
- if (!(flags & MS_KERNMOUNT)) {
- struct ipc_namespace *ns = current->nsproxy->ipc_ns;
- /* Don't allow mounting unless the caller has CAP_SYS_ADMIN
- * over the ipc namespace.
- */
- if (!ns_capable(ns->user_ns, CAP_SYS_ADMIN))
- return ERR_PTR(-EPERM);
-
- data = ns;
- }
+ if (!(flags & MS_KERNMOUNT))
+ data = current->nsproxy->ipc_ns;
return mount_ns(fs_type, flags, data, mqueue_fill_super);
}
@@ -848,8 +840,7 @@ out_putfd:
fd = error;
}
mutex_unlock(&root->d_inode->i_mutex);
- if (!ro)
- mnt_drop_write(mnt);
+ mnt_drop_write(mnt);
out_putname:
putname(name);
return fd;
@@ -921,17 +912,12 @@ static inline void pipelined_send(struct mqueue_inode_info *info,
struct msg_msg *message,
struct ext_wait_queue *receiver)
{
- /*
- * Keep them in one critical section for PREEMPT_RT:
- */
- preempt_disable_rt();
receiver->msg = message;
list_del(&receiver->list);
receiver->state = STATE_PENDING;
wake_up_process(receiver->task);
smp_wmb();
receiver->state = STATE_READY;
- preempt_enable_rt();
}
/* pipelined_receive() - if there is task waiting in sys_mq_timedsend()
@@ -945,18 +931,13 @@ static inline void pipelined_receive(struct mqueue_inode_info *info)
wake_up_interruptible(&info->wait_q);
return;
}
- /*
- * Keep them in one critical section for PREEMPT_RT:
- */
- preempt_disable_rt();
- if (!msg_insert(sender->msg, info)) {
- list_del(&sender->list);
- sender->state = STATE_PENDING;
- wake_up_process(sender->task);
- smp_wmb();
- sender->state = STATE_READY;
- }
- preempt_enable_rt();
+ if (msg_insert(sender->msg, info))
+ return;
+ list_del(&sender->list);
+ sender->state = STATE_PENDING;
+ wake_up_process(sender->task);
+ smp_wmb();
+ sender->state = STATE_READY;
}
SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr,
diff --git a/ipc/msg.c b/ipc/msg.c
index 0b60596..950572f 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -259,20 +259,12 @@ static void expunge_all(struct msg_queue *msq, int res)
while (tmp != &msq->q_receivers) {
struct msg_receiver *msr;
- /*
- * Make sure that the wakeup doesnt preempt
- * this CPU prematurely. (on PREEMPT_RT)
- */
- preempt_disable_rt();
-
msr = list_entry(tmp, struct msg_receiver, r_list);
tmp = tmp->next;
msr->r_msg = NULL;
wake_up_process(msr->r_tsk);
smp_mb();
msr->r_msg = ERR_PTR(res);
-
- preempt_enable_rt();
}
}
@@ -622,12 +614,6 @@ static inline int pipelined_send(struct msg_queue *msq, struct msg_msg *msg)
!security_msg_queue_msgrcv(msq, msg, msr->r_tsk,
msr->r_msgtype, msr->r_mode)) {
- /*
- * Make sure that the wakeup doesnt preempt
- * this CPU prematurely. (on PREEMPT_RT)
- */
- preempt_disable_rt();
-
list_del(&msr->r_list);
if (msr->r_maxsize < msg->m_ts) {
msr->r_msg = NULL;
@@ -641,11 +627,9 @@ static inline int pipelined_send(struct msg_queue *msq, struct msg_msg *msg)
wake_up_process(msr->r_tsk);
smp_mb();
msr->r_msg = msg;
- preempt_enable_rt();
return 1;
}
- preempt_enable_rt();
}
}
return 0;
@@ -836,17 +820,15 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp,
struct msg_msg *copy = NULL;
unsigned long copy_number = 0;
- ns = current->nsproxy->ipc_ns;
-
if (msqid < 0 || (long) bufsz < 0)
return -EINVAL;
if (msgflg & MSG_COPY) {
- copy = prepare_copy(buf, min_t(size_t, bufsz, ns->msg_ctlmax),
- msgflg, &msgtyp, &copy_number);
+ copy = prepare_copy(buf, bufsz, msgflg, &msgtyp, &copy_number);
if (IS_ERR(copy))
return PTR_ERR(copy);
}
mode = convert_mode(&msgtyp, msgflg);
+ ns = current->nsproxy->ipc_ns;
msq = msg_lock_check(ns, msqid);
if (IS_ERR(msq)) {
@@ -888,7 +870,6 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp,
goto out_unlock;
break;
}
- msg = ERR_PTR(-EAGAIN);
} else
break;
msg_counter++;
diff --git a/ipc/msgutil.c b/ipc/msgutil.c
index 5df8e4b..ebfcbfa 100644
--- a/ipc/msgutil.c
+++ b/ipc/msgutil.c
@@ -117,6 +117,9 @@ struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst)
if (alen > DATALEN_MSG)
alen = DATALEN_MSG;
+ dst->next = NULL;
+ dst->security = NULL;
+
memcpy(dst + 1, src + 1, alen);
len -= alen;
diff --git a/ipc/sem.c b/ipc/sem.c
index d7bdd84..58d31f1 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -461,13 +461,6 @@ undo:
static void wake_up_sem_queue_prepare(struct list_head *pt,
struct sem_queue *q, int error)
{
-#ifdef CONFIG_PREEMPT_RT_BASE
- struct task_struct *p = q->sleeper;
- get_task_struct(p);
- q->status = error;
- wake_up_process(p);
- put_task_struct(p);
-#else
if (list_empty(pt)) {
/*
* Hold preempt off so that we don't get preempted and have the
@@ -479,7 +472,6 @@ static void wake_up_sem_queue_prepare(struct list_head *pt,
q->pid = error;
list_add_tail(&q->simple_list, pt);
-#endif
}
/**
@@ -493,7 +485,6 @@ static void wake_up_sem_queue_prepare(struct list_head *pt,
*/
static void wake_up_sem_queue_do(struct list_head *pt)
{
-#ifndef CONFIG_PREEMPT_RT_BASE
struct sem_queue *q, *t;
int did_something;
@@ -506,7 +497,6 @@ static void wake_up_sem_queue_do(struct list_head *pt)
}
if (did_something)
preempt_enable();
-#endif
}
static void unlink_queue(struct sem_array *sma, struct sem_queue *q)
diff --git a/ipc/shm.c b/ipc/shm.c
index 9ec2316..4fa6d8f 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -462,7 +462,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
size_t size = params->u.size;
int error;
struct shmid_kernel *shp;
- size_t numpages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
+ int numpages = (size + PAGE_SIZE -1) >> PAGE_SHIFT;
struct file * file;
char name[13];
int id;
@@ -491,14 +491,10 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
sprintf (name, "SYSV%08x", key);
if (shmflg & SHM_HUGETLB) {
- struct hstate *hs = hstate_sizelog((shmflg >> SHM_HUGE_SHIFT)
- & SHM_HUGE_MASK);
- size_t hugesize = ALIGN(size, huge_page_size(hs));
-
/* hugetlb_file_setup applies strict accounting */
if (shmflg & SHM_NORESERVE)
acctflag = VM_NORESERVE;
- file = hugetlb_file_setup(name, hugesize, acctflag,
+ file = hugetlb_file_setup(name, 0, size, acctflag,
&shp->mlock_user, HUGETLB_SHMFS_INODE,
(shmflg >> SHM_HUGE_SHIFT) & SHM_HUGE_MASK);
} else {