diff options
Diffstat (limited to 'ipc/mqueue.c')
| -rw-r--r-- | ipc/mqueue.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index c4f6d65596cf..d1dd36a651b0 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * POSIX message queues filesystem for Linux. * @@ -9,8 +10,6 @@ * Manfred Spraul (manfred@colorfullife.com) * * Audit: George Wilson (ltcgcw@us.ibm.com) - * - * This file is released under the GPL. */ #include <linux/capability.h> @@ -211,7 +210,7 @@ static int msg_insert(struct msg_msg *msg, struct mqueue_inode_info *info) leaf = info->node_cache; info->node_cache = NULL; } else { - leaf = kmalloc(sizeof(*leaf), GFP_ATOMIC); + leaf = kmalloc_obj(*leaf, GFP_ATOMIC); if (!leaf) return -ENOMEM; INIT_LIST_HEAD(&leaf->msg_list); @@ -450,7 +449,7 @@ static int mqueue_init_fs_context(struct fs_context *fc) { struct mqueue_fs_context *ctx; - ctx = kzalloc(sizeof(struct mqueue_fs_context), GFP_KERNEL); + ctx = kzalloc_obj(struct mqueue_fs_context); if (!ctx) return -ENOMEM; @@ -609,7 +608,7 @@ out_unlock: } static int mqueue_create(struct mnt_idmap *idmap, struct inode *dir, - struct dentry *dentry, umode_t mode, bool excl) + struct dentry *dentry, umode_t mode) { return mqueue_create_attr(dentry, mode, NULL); } @@ -791,7 +790,6 @@ static void __do_notify(struct mqueue_inode_info *info) struct kernel_siginfo sig_i; struct task_struct *task; - /* do_mq_notify() accepts sigev_signo == 0, why?? */ if (!info->notify.sigev_signo) break; @@ -912,13 +910,12 @@ static struct file *mqueue_file_open(struct filename *name, static int do_mq_open(const char __user *u_name, int oflag, umode_t mode, struct mq_attr *attr) { - struct filename *name __free(putname) = NULL;; struct vfsmount *mnt = current->nsproxy->ipc_ns->mq_mnt; int fd, ro; audit_mq_open(oflag, mode, attr); - name = getname(u_name); + CLASS(filename, name)(u_name); if (IS_ERR(name)) return PTR_ERR(name); @@ -942,20 +939,19 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode, SYSCALL_DEFINE1(mq_unlink, const char __user *, u_name) { int err; - struct filename *name; struct dentry *dentry; struct inode *inode; struct ipc_namespace *ipc_ns = current->nsproxy->ipc_ns; struct vfsmount *mnt = ipc_ns->mq_mnt; + CLASS(filename, name)(u_name); - name = getname(u_name); if (IS_ERR(name)) return PTR_ERR(name); audit_inode_parent_hidden(name, mnt->mnt_root); err = mnt_want_write(mnt); if (err) - goto out_name; + return err; dentry = start_removing_noperm(mnt->mnt_root, &QSTR(name->name)); if (IS_ERR(dentry)) { err = PTR_ERR(dentry); @@ -971,9 +967,6 @@ SYSCALL_DEFINE1(mq_unlink, const char __user *, u_name) out_drop_write: mnt_drop_write(mnt); -out_name: - putname(name); - return err; } @@ -1094,7 +1087,7 @@ static int do_mq_timedsend(mqd_t mqdes, const char __user *u_msg_ptr, * fall back to that if necessary. */ if (!info->node_cache) - new_leaf = kmalloc(sizeof(*new_leaf), GFP_KERNEL); + new_leaf = kmalloc_obj(*new_leaf); spin_lock(&info->lock); @@ -1187,7 +1180,7 @@ static int do_mq_timedreceive(mqd_t mqdes, char __user *u_msg_ptr, * fall back to that if necessary. */ if (!info->node_cache) - new_leaf = kmalloc(sizeof(*new_leaf), GFP_KERNEL); + new_leaf = kmalloc_obj(*new_leaf); spin_lock(&info->lock); @@ -1287,9 +1280,9 @@ static int do_mq_notify(mqd_t mqdes, const struct sigevent *notification) notification->sigev_notify != SIGEV_THREAD)) return -EINVAL; if (notification->sigev_notify == SIGEV_SIGNAL && - !valid_signal(notification->sigev_signo)) { + (!notification->sigev_signo || + !valid_signal(notification->sigev_signo))) return -EINVAL; - } if (notification->sigev_notify == SIGEV_THREAD) { long timeo; |
