Skip to contentSkip to conversation

More LSM changes for 2.5.49

PATCH New Greg KH 1 participant 6 messages Nov 27, 2002 – Nov 28, 2002

Subsystems (16)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 More LSM changes for 2.5.49

Here are some patches that change the way I had previoulsy written the if {} statments for the LSM hooks in the last round of patches. This should make them more readable, sorry for the previous version. I've also included a patch for a place where I had missed the conversion of the hooks in the last merge in the hugetlbfs code.

Please pull from:

	bk://lsm.bkbits.net/linus-2.5

thanks,

greg k-h

 arch/arm/kernel/ptrace.c          |    3 +-
 arch/i386/kernel/ptrace.c         |    3 +-
 arch/ia64/kernel/ptrace.c         |    3 +-
 arch/ppc/kernel/ptrace.c          |    3 +-
 arch/ppc64/kernel/ptrace.c        |    3 +-
 arch/ppc64/kernel/ptrace32.c      |    3 +-
 arch/ppc64/kernel/sys_ppc32.c     |    3 +-
 arch/s390/kernel/ptrace.c         |    3 +-
 arch/s390x/kernel/ptrace.c        |    3 +-
 arch/sparc/kernel/ptrace.c        |    3 +-
 arch/sparc64/kernel/ptrace.c      |    3 +-
 arch/sparc64/kernel/sys_sparc32.c |    3 +-
 arch/um/kernel/ptrace.c           |    3 +-
 arch/x86_64/kernel/ptrace.c       |    3 +-
 fs/attr.c                         |    3 +-
 fs/dquot.c                        |    3 +-
 fs/exec.c                         |    9 +++++---
 fs/fcntl.c                        |    9 +++++---
 fs/hugetlbfs/inode.c              |    4 +--
 fs/ioctl.c                        |    3 +-
 fs/locks.c                        |   12 +++++++---
 fs/namei.c                        |   33 +++++++++++++++++++----------
 fs/namespace.c                    |   12 +++++++---
 fs/open.c                         |    3 +-
 fs/read_write.c                   |    6 +++--
 fs/readdir.c                      |    3 +-
 fs/stat.c                         |    6 +++--
 fs/xattr.c                        |   12 +++++++---
 ipc/msg.c                         |    3 +-
 ipc/sem.c                         |    3 +-
 ipc/shm.c                         |    3 +-
 kernel/acct.c                     |    3 +-
 kernel/fork.c                     |    3 +-
 kernel/ptrace.c                   |    3 +-
 kernel/sched.c                    |   15 +++++++++----
 kernel/signal.c                   |    3 +-
 kernel/sys.c                      |   42 +++++++++++++++++++++++++-------------
 kernel/uid16.c                    |    3 +-
 mm/mmap.c                         |    3 +-
 mm/mprotect.c                     |    3 +-
 net/core/scm.c                    |    3 +-
 41 files changed, 166 insertions(+), 84 deletions(-)

-----

[email protected], 2002-11-27 15:14:22-08:00, [email protected]
LSM: change if statements into something more readable for the arch/* files.

 arch/arm/kernel/ptrace.c          |    3 ++-
 arch/i386/kernel/ptrace.c         |    3 ++-
 arch/ia64/kernel/ptrace.c         |    3 ++-
 arch/ppc/kernel/ptrace.c          |    3 ++-
 arch/ppc64/kernel/ptrace.c        |    3 ++-
 arch/ppc64/kernel/ptrace32.c      |    3 ++-
 arch/ppc64/kernel/sys_ppc32.c     |    3 ++-
 arch/s390/kernel/ptrace.c         |    3 ++-
 arch/s390x/kernel/ptrace.c        |    3 ++-
 arch/sparc/kernel/ptrace.c        |    3 ++-
 arch/sparc64/kernel/ptrace.c      |    3 ++-
 arch/sparc64/kernel/sys_sparc32.c |    3 ++-
 arch/um/kernel/ptrace.c           |    3 ++-
 arch/x86_64/kernel/ptrace.c       |    3 ++-
 14 files changed, 28 insertions(+), 14 deletions(-)

------

[email protected], 2002-11-27 15:13:40-08:00, [email protected]
LSM: change if statements into something more readable for the kernel.* files.

 kernel/acct.c   |    3 ++-
 kernel/fork.c   |    3 ++-
 kernel/ptrace.c |    3 ++-
 kernel/sched.c  |   15 ++++++++++-----
 kernel/signal.c |    3 ++-
 kernel/sys.c    |   42 ++++++++++++++++++++++++++++--------------
 kernel/uid16.c  |    3 ++-
 7 files changed, 48 insertions(+), 24 deletions(-)

------

[email protected], 2002-11-27 15:12:52-08:00, [email protected]
LSM: change if statements into something more readable for the ipc/*, mm/*, and net/* files.

 ipc/msg.c      |    3 ++-
 ipc/sem.c      |    3 ++-
 ipc/shm.c      |    3 ++-
 mm/mmap.c      |    3 ++-
 mm/mprotect.c  |    3 ++-
 net/core/scm.c |    3 ++-
 6 files changed, 12 insertions(+), 6 deletions(-)

------

[email protected], 2002-11-27 15:11:25-08:00, [email protected]
LSM: change if statements into something more readable for the fs/* files.

 fs/attr.c       |    3 ++-
 fs/dquot.c      |    3 ++-
 fs/exec.c       |    9 ++++++---
 fs/fcntl.c      |    9 ++++++---
 fs/ioctl.c      |    3 ++-
 fs/locks.c      |   12 ++++++++----
 fs/namei.c      |   33 ++++++++++++++++++++++-----------
 fs/namespace.c  |   12 ++++++++----
 fs/open.c       |    3 ++-
 fs/read_write.c |    6 ++++--
 fs/readdir.c    |    3 ++-
 fs/stat.c       |    6 ++++--
 fs/xattr.c      |   12 ++++++++----
 13 files changed, 76 insertions(+), 38 deletions(-)

------

[email protected], 2002-11-27 15:09:52-08:00, [email protected]
LSM: fix conversions in hugetlbfs that I missed in the last merge.

 fs/hugetlbfs/inode.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

------

author
#1 lore raw

PATCH 1/1 More LSM changes for 2.5.49

ChangeSet 1.925, 2002/11/27 15:09:52-08:00, [email protected]

LSM: fix conversions in hugetlbfs that I missed in the last merge.

fs/hugetlbfs/inode.c +2 -2
diff -Nru a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
@@ -209,7 +209,7 @@
 	if (inode->i_data.nrpages)
 		truncate_hugepages(&inode->i_data, 0);
 
-	security_ops->inode_delete(inode);
+	security_inode_delete(inode);
 
 	clear_inode(inode);
 	destroy_inode(inode);
@@ -333,7 +333,7 @@
 	if (error)
 		goto out;
 
-	error = security_ops->inode_setattr(dentry, attr);
+	error = security_inode_setattr(dentry, attr);
 	if (error)
 		goto out;
 
author
#2 lore raw

ChangeSet 1.926, 2002/11/27 15:11:25-08:00, [email protected]

LSM: change if statements into something more readable for the fs/* files.

fs/attr.c +2 -1
diff -Nru a/fs/attr.c b/fs/attr.c
@@ -157,7 +157,8 @@
 		return 0;
 
 	if (inode->i_op && inode->i_op->setattr) {
-		if (!(error = security_inode_setattr(dentry, attr)))
+		error = security_inode_setattr(dentry, attr);
+		if (!error)
 			error = inode->i_op->setattr(dentry, attr);
 	} else {
 		error = inode_change_ok(inode, attr);
fs/dquot.c +2 -1
diff -Nru a/fs/dquot.c b/fs/dquot.c
@@ -1307,7 +1307,8 @@
 	error = -EIO;
 	if (!f->f_op || !f->f_op->read || !f->f_op->write)
 		goto out_f;
-	if ((error = security_quota_on(f)))
+	error = security_quota_on(f);
+	if (error)
 		goto out_f;
 	inode = f->f_dentry->d_inode;
 	error = -EACCES;
fs/exec.c +6 -3
diff -Nru a/fs/exec.c b/fs/exec.c
@@ -841,7 +841,8 @@
 	}
 
 	/* fill in binprm security blob */
-	if ((retval = security_bprm_set(bprm)))
+	retval = security_bprm_set(bprm);
+	if (retval)
 		return retval;
 
 	memset(bprm->buf,0,BINPRM_BUF_SIZE);
@@ -958,7 +959,8 @@
 	    }
 	}
 #endif
-	if ((retval = security_bprm_check(bprm)))
+	retval = security_bprm_check(bprm);
+	if (retval)
 		return retval;
 
 	/* kernel module loader fixup */
@@ -1054,7 +1056,8 @@
 	if ((retval = bprm.envc) < 0)
 		goto out_mm;
 
-	if ((retval = security_bprm_alloc(&bprm)))
+	retval = security_bprm_alloc(&bprm);
+	if (retval)
 		goto out;
 
 	retval = prepare_binprm(&bprm);
fs/fcntl.c +6 -3
diff -Nru a/fs/fcntl.c b/fs/fcntl.c
@@ -274,7 +274,8 @@
 {
 	int err;
 	
-	if ((err = security_file_set_fowner(filp)))
+	err = security_file_set_fowner(filp);
+	if (err)
 		return err;
 
 	f_modown(filp, arg, current->uid, current->euid, force);
@@ -367,7 +368,8 @@
 	if (!filp)
 		goto out;
 
-	if ((err = security_file_fcntl(filp, cmd, arg))) {
+	err = security_file_fcntl(filp, cmd, arg);
+	if (err) {
 		fput(filp);
 		return err;
 	}
@@ -390,7 +392,8 @@
 	if (!filp)
 		goto out;
 
-	if ((err = security_file_fcntl(filp, cmd, arg))) {
+	err = security_file_fcntl(filp, cmd, arg);
+	if (err) {
 		fput(filp);
 		return err;
 	}
fs/ioctl.c +2 -1
diff -Nru a/fs/ioctl.c b/fs/ioctl.c
@@ -59,7 +59,8 @@
 		goto out;
 	error = 0;
 
-	if ((error = security_file_ioctl(filp, cmd, arg))) {
+	error = security_file_ioctl(filp, cmd, arg);
+	if (error) {
                 fput(filp);
                 goto out;
         }
fs/locks.c +8 -4
diff -Nru a/fs/locks.c b/fs/locks.c
@@ -1185,7 +1185,8 @@
 		return -EACCES;
 	if (!S_ISREG(inode->i_mode))
 		return -EINVAL;
-	if ((error = security_file_lock(filp, arg)))
+	error = security_file_lock(filp, arg);
+	if (error)
 		return error;
 
 	lock_kernel();
@@ -1298,7 +1299,8 @@
 	if (error)
 		goto out_putf;
 
-	if ((error = security_file_lock(filp, cmd)))
+	error = security_file_lock(filp, cmd);
+	if (error)
 		goto out_free;
 
 	for (;;) {
@@ -1449,7 +1451,8 @@
 		goto out;
 	}
 
-	if ((error = security_file_lock(filp, file_lock->fl_type)))
+	error = security_file_lock(filp, file_lock->fl_type);
+	if (error)
 		goto out;
 
 	if (filp->f_op && filp->f_op->lock != NULL) {
@@ -1588,7 +1591,8 @@
 		goto out;
 	}
 
-	if ((error = security_file_lock(filp, file_lock->fl_type)))
+	error = security_file_lock(filp, file_lock->fl_type);
+	if (error)
 		goto out;
 
 	if (filp->f_op && filp->f_op->lock != NULL) {
fs/namei.c +22 -11
diff -Nru a/fs/namei.c b/fs/namei.c
@@ -413,7 +413,8 @@
 		current->state = TASK_RUNNING;
 		schedule();
 	}
-	if ((err = security_inode_follow_link(dentry, nd)))
+	err = security_inode_follow_link(dentry, nd);
+	if (err)
 		goto loop;
 	current->link_count++;
 	current->total_link_count++;
@@ -1124,7 +1125,8 @@
 		return -EACCES;	/* shouldn't it be ENOSYS? */
 	mode &= S_IALLUGO;
 	mode |= S_IFREG;
-	if ((error = security_inode_create(dir, dentry, mode)))
+	error = security_inode_create(dir, dentry, mode);
+	if (error)
 		return error;
 	DQUOT_INIT(dir);
 	error = dir->i_op->create(dir, dentry, mode);
@@ -1343,7 +1345,8 @@
 	 * stored in nd->last.name and we will have to putname() it when we
 	 * are done. Procfs-like symlinks just set LAST_BIND.
 	 */
-	if ((error = security_inode_follow_link(dentry, nd)))
+	error = security_inode_follow_link(dentry, nd);
+	if (error)
 		goto exit_dput;
 	UPDATE_ATIME(dentry->d_inode);
 	error = dentry->d_inode->i_op->follow_link(dentry, nd);
@@ -1408,7 +1411,8 @@
 	if (!dir->i_op || !dir->i_op->mknod)
 		return -EPERM;
 
-	if ((error = security_inode_mknod(dir, dentry, mode, dev)))
+	error = security_inode_mknod(dir, dentry, mode, dev);
+	if (error)
 		return error;
 
 	DQUOT_INIT(dir);
@@ -1476,7 +1480,8 @@
 		return -EPERM;
 
 	mode &= (S_IRWXUGO|S_ISVTX);
-	if ((error = security_inode_mkdir(dir, dentry, mode)))
+	error = security_inode_mkdir(dir, dentry, mode);
+	if (error)
 		return error;
 
 	DQUOT_INIT(dir);
@@ -1568,7 +1573,8 @@
 	if (d_mountpoint(dentry))
 		error = -EBUSY;
 	else {
-		if (!(error = security_inode_rmdir(dir, dentry))) {
+		error = security_inode_rmdir(dir, dentry);
+		if (!error) {
 			error = dir->i_op->rmdir(dir, dentry);
 			if (!error)
 				dentry->d_inode->i_flags |= S_DEAD;
@@ -1641,7 +1647,8 @@
 	if (d_mountpoint(dentry))
 		error = -EBUSY;
 	else {
-		if (!(error = security_inode_unlink(dir, dentry)))
+		error = security_inode_unlink(dir, dentry);
+		if (error)
 			error = dir->i_op->unlink(dir, dentry);
 	}
 	up(&dentry->d_inode->i_sem);
@@ -1704,7 +1711,8 @@
 	if (!dir->i_op || !dir->i_op->symlink)
 		return -EPERM;
 
-	if ((error = security_inode_symlink(dir, dentry, oldname)))
+	error = security_inode_symlink(dir, dentry, oldname);
+	if (error)
 		return error;
 
 	DQUOT_INIT(dir);
@@ -1774,7 +1782,8 @@
 	if (S_ISDIR(old_dentry->d_inode->i_mode))
 		return -EPERM;
 
-	if ((error = security_inode_link(old_dentry, dir, new_dentry)))
+	error = security_inode_link(old_dentry, dir, new_dentry);
+	if (error)
 		return error;
 
 	down(&old_dentry->d_inode->i_sem);
@@ -1882,7 +1891,8 @@
 			return error;
 	}
 
-	if ((error = security_inode_rename(old_dir, old_dentry, new_dir, new_dentry)))
+	error = security_inode_rename(old_dir, old_dentry, new_dir, new_dentry);
+	if (error)
 		return error;
 
 	target = new_dentry->d_inode;
@@ -1916,7 +1926,8 @@
 	struct inode *target;
 	int error;
 
-	if ((error = security_inode_rename(old_dir, old_dentry, new_dir, new_dentry)))
+	error = security_inode_rename(old_dir, old_dentry, new_dir, new_dentry);
+	if (error)
 		return error;
 
 	dget(new_dentry);
fs/namespace.c +8 -4
diff -Nru a/fs/namespace.c b/fs/namespace.c
@@ -289,7 +289,8 @@
 	struct super_block * sb = mnt->mnt_sb;
 	int retval = 0;
 
-	if ((retval = security_sb_umount(mnt, flags)))
+	retval = security_sb_umount(mnt, flags);
+	if (retval)
 		return retval;
 
 	/*
@@ -470,7 +471,8 @@
 	if (IS_DEADDIR(nd->dentry->d_inode))
 		goto out_unlock;
 
-	if ((err = security_sb_check_sb(mnt, nd)))
+	err = security_sb_check_sb(mnt, nd);
+	if (err)
 		goto out_unlock;
 
 	spin_lock(&dcache_lock);
@@ -740,7 +742,8 @@
 	if (retval)
 		return retval;
 
-	if ((retval = security_sb_mount(dev_name, &nd, type_page, flags, data_page)))
+	retval = security_sb_mount(dev_name, &nd, type_page, flags, data_page);
+	if (retval)
 		goto dput_out;
 
 	if (flags & MS_REMOUNT)
@@ -985,7 +988,8 @@
 	if (error)
 		goto out1;
 
-	if ((error = security_sb_pivotroot(&old_nd, &new_nd))) {
+	error = security_sb_pivotroot(&old_nd, &new_nd);
+	if (error) {
 		path_release(&old_nd);
 		goto out1;
 	}
fs/open.c +2 -1
diff -Nru a/fs/open.c b/fs/open.c
@@ -31,7 +31,8 @@
 		retval = -ENOSYS;
 		if (sb->s_op && sb->s_op->statfs) {
 			memset(buf, 0, sizeof(struct statfs));
-			if ((retval = security_sb_statfs(sb)))
+			retval = security_sb_statfs(sb);
+			if (retval)
 				return retval;
 			retval = sb->s_op->statfs(sb, buf);
 		}
fs/read_write.c +4 -2
diff -Nru a/fs/read_write.c b/fs/read_write.c
@@ -193,7 +193,8 @@
 
 	ret = locks_verify_area(FLOCK_VERIFY_READ, inode, file, *pos, count);
 	if (!ret) {
-		if (!(ret = security_file_permission (file, MAY_READ))) {
+		ret = security_file_permission (file, MAY_READ);
+		if (!ret) {
 			if (file->f_op->read)
 				ret = file->f_op->read(file, buf, count, pos);
 			else
@@ -232,7 +233,8 @@
 
 	ret = locks_verify_area(FLOCK_VERIFY_WRITE, inode, file, *pos, count);
 	if (!ret) {
-		if (!(ret = security_file_permission (file, MAY_WRITE))) {
+		ret = security_file_permission (file, MAY_WRITE);
+		if (!ret) {
 			if (file->f_op->write)
 				ret = file->f_op->write(file, buf, count, pos);
 			else
fs/readdir.c +2 -1
diff -Nru a/fs/readdir.c b/fs/readdir.c
@@ -22,7 +22,8 @@
 	if (!file->f_op || !file->f_op->readdir)
 		goto out;
 
-	if ((res = security_file_permission(file, MAY_READ)))
+	res = security_file_permission(file, MAY_READ);
+	if (res)
 		goto out;
 
 	down(&inode->i_sem);
fs/stat.c +4 -2
diff -Nru a/fs/stat.c b/fs/stat.c
@@ -38,7 +38,8 @@
 	struct inode *inode = dentry->d_inode;
 	int retval;
 
-	if ((retval = security_inode_getattr(mnt, dentry)))
+	retval = security_inode_getattr(mnt, dentry);
+	if (retval)
 		return retval;
 
 	if (inode->i_op->getattr)
@@ -241,7 +242,8 @@
 
 		error = -EINVAL;
 		if (inode->i_op && inode->i_op->readlink) {
-			if (!(error = security_inode_readlink(nd.dentry))) {
+			error = security_inode_readlink(nd.dentry);
+			if (!error) {
 				UPDATE_ATIME(inode);
 				error = inode->i_op->readlink(nd.dentry, buf, bufsiz);
 			}
fs/xattr.c +8 -4
diff -Nru a/fs/xattr.c b/fs/xattr.c
@@ -86,7 +86,8 @@
 
 	error = -EOPNOTSUPP;
 	if (d->d_inode->i_op && d->d_inode->i_op->setxattr) {
-		if ((error = security_inode_setxattr(d, kname, kvalue, size, flags)))
+		error = security_inode_setxattr(d, kname, kvalue, size, flags);
+		if (error)
 			goto out;
 		down(&d->d_inode->i_sem);
 		error = d->d_inode->i_op->setxattr(d, kname, kvalue, size, flags);
@@ -162,7 +163,8 @@
 
 	error = -EOPNOTSUPP;
 	if (d->d_inode->i_op && d->d_inode->i_op->getxattr) {
-		if ((error = security_inode_getxattr(d, kname)))
+		error = security_inode_getxattr(d, kname);
+		if (error)
 			goto out;
 		down(&d->d_inode->i_sem);
 		error = d->d_inode->i_op->getxattr(d, kname, kvalue, size);
@@ -234,7 +236,8 @@
 
 	error = -EOPNOTSUPP;
 	if (d->d_inode->i_op && d->d_inode->i_op->listxattr) {
-		if ((error = security_inode_listxattr(d)))
+		error = security_inode_listxattr(d);
+		if (error)
 			goto out;
 		down(&d->d_inode->i_sem);
 		error = d->d_inode->i_op->listxattr(d, klist, size);
@@ -308,7 +311,8 @@
 
 	error = -EOPNOTSUPP;
 	if (d->d_inode->i_op && d->d_inode->i_op->removexattr) {
-		if ((error = security_inode_removexattr(d, kname)))
+		error = security_inode_removexattr(d, kname);
+		if (error)
 			goto out;
 		down(&d->d_inode->i_sem);
 		error = d->d_inode->i_op->removexattr(d, kname);
author
#3 lore raw

ChangeSet 1.927, 2002/11/27 15:12:52-08:00, [email protected]

LSM: change if statements into something more readable for the ipc/*, mm/*, and net/* files.

ipc/msg.c +2 -1
diff -Nru a/ipc/msg.c b/ipc/msg.c
@@ -101,7 +101,8 @@
 	msq->q_perm.key = key;
 
 	msq->q_perm.security = NULL;
-	if ((retval = security_msg_queue_alloc(msq))) {
+	retval = security_msg_queue_alloc(msq);
+	if (retval) {
 		ipc_rcu_free(msq, sizeof(*msq));
 		return retval;
 	}
ipc/sem.c +2 -1
diff -Nru a/ipc/sem.c b/ipc/sem.c
@@ -136,7 +136,8 @@
 	sma->sem_perm.key = key;
 
 	sma->sem_perm.security = NULL;
-	if ((retval = security_sem_alloc(sma))) {
+	retval = security_sem_alloc(sma);
+	if (retval) {
 		ipc_rcu_free(sma, size);
 		return retval;
 	}
ipc/shm.c +2 -1
diff -Nru a/ipc/shm.c b/ipc/shm.c
@@ -188,7 +188,8 @@
 	shp->shm_flags = (shmflg & S_IRWXUGO);
 
 	shp->shm_perm.security = NULL;
-	if ((error = security_shm_alloc(shp))) {
+	error = security_shm_alloc(shp);
+	if (error) {
 		ipc_rcu_free(shp, sizeof(*shp));
 		return error;
 	}
mm/mmap.c +2 -1
diff -Nru a/mm/mmap.c b/mm/mmap.c
@@ -504,7 +504,8 @@
 		}
 	}
 
-	if ((error = security_file_mmap(file, prot, flags)))
+	error = security_file_mmap(file, prot, flags);
+	if (error)
 		return error;
 		
 	/* Clear old maps */
mm/mprotect.c +2 -1
diff -Nru a/mm/mprotect.c b/mm/mprotect.c
@@ -263,7 +263,8 @@
 			goto out;
 		}
 
-		if ((error = security_file_mprotect(vma, prot)))
+		error = security_file_mprotect(vma, prot);
+		if (error)
 			goto out;
 
 		if (vma->vm_end > end) {
net/core/scm.c +2 -1
diff -Nru a/net/core/scm.c b/net/core/scm.c
@@ -217,7 +217,8 @@
 	for (i=0, cmfptr=(int*)CMSG_DATA(cm); i<fdmax; i++, cmfptr++)
 	{
 		int new_fd;
-		if ((err = security_file_receive(fp[i])))
+		err = security_file_receive(fp[i]);
+		if (err)
 			break;
 		err = get_unused_fd();
 		if (err < 0)
author
#4 lore raw

ChangeSet 1.928, 2002/11/27 15:13:40-08:00, [email protected]

LSM: change if statements into something more readable for the kernel.* files.

kernel/acct.c +2 -1
diff -Nru a/kernel/acct.c b/kernel/acct.c
@@ -223,7 +223,8 @@
 		}
 	}
 
-	if ((error = security_acct(file)))
+	error = security_acct(file);
+	if (error)
 		return error;
 
 	spin_lock(&acct_globals.lock);
kernel/fork.c +2 -1
diff -Nru a/kernel/fork.c b/kernel/fork.c
@@ -717,7 +717,8 @@
 	if ((clone_flags & CLONE_DETACHED) && !(clone_flags & CLONE_THREAD))
 		return ERR_PTR(-EINVAL);
 
-	if ((retval = security_task_create(clone_flags)))
+	retval = security_task_create(clone_flags);
+	if (retval)
 		goto fork_out;
 
 	retval = -ENOMEM;
kernel/ptrace.c +2 -1
diff -Nru a/kernel/ptrace.c b/kernel/ptrace.c
@@ -101,7 +101,8 @@
 	/* the same process cannot be attached many times */
 	if (task->ptrace & PT_PTRACED)
 		goto bad;
-	if ((retval = security_ptrace(current, task)))
+	retval = security_ptrace(current, task);
+	if (retval)
 		goto bad;
 
 	/* Go */
kernel/sched.c +10 -5
diff -Nru a/kernel/sched.c b/kernel/sched.c
@@ -1348,7 +1348,8 @@
 	if (nice > 19)
 		nice = 19;
 
-	if ((retval = security_task_setnice(current, nice)))
+	retval = security_task_setnice(current, nice);
+	if (retval)
 		return retval;
 
 	set_user_nice(current, nice);
@@ -1469,7 +1470,8 @@
 	    !capable(CAP_SYS_NICE))
 		goto out_unlock;
 
-	if ((retval = security_task_setscheduler(p, policy, &lp)))
+	retval = security_task_setscheduler(p, policy, &lp);
+	if (retval)
 		goto out_unlock;
 
 	array = p->array;
@@ -1532,7 +1534,8 @@
 	read_lock(&tasklist_lock);
 	p = find_process_by_pid(pid);
 	if (p) {
-		if (!(retval = security_task_getscheduler(p)))
+		retval = security_task_getscheduler(p);
+		if (!retval)
 			retval = p->policy;
 	}
 	read_unlock(&tasklist_lock);
@@ -1561,7 +1564,8 @@
 	if (!p)
 		goto out_unlock;
 
-	if ((retval = security_task_getscheduler(p)))
+	retval = security_task_getscheduler(p);
+	if (retval)
 		goto out_unlock;
 
 	lp.sched_priority = p->rt_priority;
@@ -1820,7 +1824,8 @@
 	if (!p)
 		goto out_unlock;
 
-	if ((retval = security_task_getscheduler(p)))
+	retval = security_task_getscheduler(p);
+	if (retval)
 		goto out_unlock;
 
 	jiffies_to_timespec(p->policy & SCHED_FIFO ?
kernel/signal.c +2 -1
diff -Nru a/kernel/signal.c b/kernel/signal.c
@@ -739,7 +739,8 @@
 	ret = -EPERM;
 	if (bad_signal(sig, info, t))
 		goto out;
-	if ((ret = security_task_kill(t, info, sig)))
+	ret = security_task_kill(t, info, sig);
+	if (ret)
 		goto out;
 
 	/* The null signal is a permissions and process existence probe.
kernel/sys.c +28 -14

126 lines not on this page · raw message

kernel/uid16.c +2 -1
diff -Nru a/kernel/uid16.c b/kernel/uid16.c
@@ -140,7 +140,8 @@
 		return -EFAULT;
 	for (i = 0 ; i < gidsetsize ; i++)
 		new_groups[i] = (gid_t)groups[i];
-	if ((i = security_task_setgroups(gidsetsize, new_groups)))
+	i = security_task_setgroups(gidsetsize, new_groups);
+	if (i)
 		return i;
 	memcpy(current->groups, new_groups, gidsetsize * sizeof(gid_t));
 	current->ngroups = gidsetsize;
author
#5 lore raw

ChangeSet 1.929, 2002/11/27 15:14:22-08:00, [email protected]

LSM: change if statements into something more readable for the arch/* files.

arch/arm/kernel/ptrace.c +2 -1
diff -Nru a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
@@ -711,7 +711,8 @@
 		/* are we already being traced? */
 		if (current->ptrace & PT_PTRACED)
 			goto out;
-		if ((ret = security_ptrace(current->parent, current)))
+		ret = security_ptrace(current->parent, current);
+		if (ret)
 			goto out;
 		/* set the ptrace bit in the process flags. */
 		current->ptrace |= PT_PTRACED;
arch/i386/kernel/ptrace.c +2 -1
diff -Nru a/arch/i386/kernel/ptrace.c b/arch/i386/kernel/ptrace.c
@@ -160,7 +160,8 @@
 		/* are we already being traced? */
 		if (current->ptrace & PT_PTRACED)
 			goto out;
-		if ((ret = security_ptrace(current->parent, current)))
+		ret = security_ptrace(current->parent, current);
+		if (ret)
 			goto out;
 		/* set the ptrace bit in the process flags. */
 		current->ptrace |= PT_PTRACED;
arch/ia64/kernel/ptrace.c +2 -1
diff -Nru a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c
@@ -1101,7 +1101,8 @@
 		/* are we already being traced? */
 		if (current->ptrace & PT_PTRACED)
 			goto out;
-		if ((ret = security_ptrace(current->parent, current)))
+		ret = security_ptrace(current->parent, current);
+		if (ret)
 			goto out;
 		current->ptrace |= PT_PTRACED;
 		ret = 0;
arch/ppc/kernel/ptrace.c +2 -1
diff -Nru a/arch/ppc/kernel/ptrace.c b/arch/ppc/kernel/ptrace.c
@@ -166,7 +166,8 @@
 		/* are we already being traced? */
 		if (current->ptrace & PT_PTRACED)
 			goto out;
-		if ((ret = security_ptrace(current->parent, current)))
+		ret = security_ptrace(current->parent, current);
+		if (ret)
 			goto out;
 		/* set the ptrace bit in the process flags. */
 		current->ptrace |= PT_PTRACED;
arch/ppc64/kernel/ptrace.c +2 -1
diff -Nru a/arch/ppc64/kernel/ptrace.c b/arch/ppc64/kernel/ptrace.c
@@ -59,7 +59,8 @@
 		/* are we already being traced? */
 		if (current->ptrace & PT_PTRACED)
 			goto out;
-		if ((ret = security_ptrace(current->parent, current)))
+		ret = security_ptrace(current->parent, current);
+		if (ret)
 			goto out;
 		/* set the ptrace bit in the process flags. */
 		current->ptrace |= PT_PTRACED;
arch/ppc64/kernel/ptrace32.c +2 -1
diff -Nru a/arch/ppc64/kernel/ptrace32.c b/arch/ppc64/kernel/ptrace32.c
@@ -48,7 +48,8 @@
 		/* are we already being traced? */
 		if (current->ptrace & PT_PTRACED)
 			goto out;
-		if ((ret = security_ptrace(current->parent, current)))
+		ret = security_ptrace(current->parent, current);
+		if (ret)
 			goto out;
 		/* set the ptrace bit in the process flags. */
 		current->ptrace |= PT_PTRACED;
arch/ppc64/kernel/sys_ppc32.c +2 -1
diff -Nru a/arch/ppc64/kernel/sys_ppc32.c b/arch/ppc64/kernel/sys_ppc32.c
@@ -3521,7 +3521,8 @@
 	if ((retval = bprm.envc) < 0)
 		goto out_mm;
 
-	if ((retval = security_bprm_alloc(&bprm)))
+	retval = security_bprm_alloc(&bprm);
+	if (retval)
 		goto out;
 
 	retval = prepare_binprm(&bprm);
arch/s390/kernel/ptrace.c +2 -1
diff -Nru a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
@@ -323,7 +323,8 @@
 		ret = -EPERM;
 		if (current->ptrace & PT_PTRACED)
 			goto out;
-		if ((ret = security_ptrace(current->parent, current)))
+		ret = security_ptrace(current->parent, current);
+		if (ret)
 			goto out;
 		/* set the ptrace bit in the process flags. */
 		current->ptrace |= PT_PTRACED;
arch/s390x/kernel/ptrace.c +2 -1
diff -Nru a/arch/s390x/kernel/ptrace.c b/arch/s390x/kernel/ptrace.c
@@ -563,7 +563,8 @@
 		ret = -EPERM;
 		if (current->ptrace & PT_PTRACED)
 			goto out;
-		if ((ret = security_ptrace(current->parent, current)))
+		ret = security_ptrace(current->parent, current);
+		if (ret)
 			goto out;
 		/* set the ptrace bit in the process flags. */
 		current->ptrace |= PT_PTRACED;
arch/sparc/kernel/ptrace.c +2 -1
diff -Nru a/arch/sparc/kernel/ptrace.c b/arch/sparc/kernel/ptrace.c
@@ -291,7 +291,8 @@
 			pt_error_return(regs, EPERM);
 			goto out;
 		}
-		if ((ret = security_ptrace(current->parent, current))) {
+		ret = security_ptrace(current->parent, current);
+		if (ret) {
 			pt_error_return(regs, -ret);
 			goto out;
 		}
arch/sparc64/kernel/ptrace.c +2 -1
diff -Nru a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c
@@ -140,7 +140,8 @@
 			pt_error_return(regs, EPERM);
 			goto out;
 		}
-		if ((ret = security_ptrace(current->parent, current))) {
+		ret = security_ptrace(current->parent, current);
+		if (ret) {
 			pt_error_return(regs, -ret);
 			goto out;
 		}
arch/sparc64/kernel/sys_sparc32.c +2 -1
diff -Nru a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
@@ -3026,7 +3026,8 @@
 	if ((retval = bprm.envc) < 0)
 		goto out_mm;
 
-	if ((retval = security_bprm_alloc(&bprm)))
+	retval = security_bprm_alloc(&bprm);
+	if (retval)
 		goto out;
 
 	retval = prepare_binprm(&bprm);
arch/um/kernel/ptrace.c +2 -1
diff -Nru a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c
@@ -33,7 +33,8 @@
 		if (current->ptrace & PT_PTRACED)
 			goto out;
 
-		if ((ret = security_ptrace(current->parent, current)))
+		ret = security_ptrace(current->parent, current);
+		if (ret)
  			goto out;
 
 		/* set the ptrace bit in the process flags. */
arch/x86_64/kernel/ptrace.c +2 -1
diff -Nru a/arch/x86_64/kernel/ptrace.c b/arch/x86_64/kernel/ptrace.c
@@ -178,7 +178,8 @@
 		/* are we already being traced? */
 		if (current->ptrace & PT_PTRACED)
 			goto out;
-		if ((ret = security_ptrace(current->parent, current)))
+		ret = security_ptrace(current->parent, current);
+		if (ret)
 			goto out;
 		/* set the ptrace bit in the process flags. */
 		current->ptrace |= PT_PTRACED;