All of lore.kernel.org
 help / color / mirror / Atom feed
* [BK PATCH] More LSM changes for 2.5.49
@ 2002-11-27 23:06 Greg KH
  2002-11-28  0:26 ` [PATCH] " Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2002-11-27 23:06 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel, linux-security-module

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(-)
-----

ChangeSet@1.929, 2002-11-27 15:14:22-08:00, greg@kroah.com
  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(-)
------

ChangeSet@1.928, 2002-11-27 15:13:40-08:00, greg@kroah.com
  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(-)
------

ChangeSet@1.927, 2002-11-27 15:12:52-08:00, greg@kroah.com
  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(-)
------

ChangeSet@1.926, 2002-11-27 15:11:25-08:00, greg@kroah.com
  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(-)
------

ChangeSet@1.925, 2002-11-27 15:09:52-08:00, greg@kroah.com
  LSM: fix conversions in hugetlbfs that I missed in the last merge.

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] More LSM changes for 2.5.49
  2002-11-27 23:06 [BK PATCH] More LSM changes for 2.5.49 Greg KH
@ 2002-11-28  0:26 ` Greg KH
  2002-11-28  0:27   ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2002-11-28  0:26 UTC (permalink / raw)
  To: linux-kernel, linux-security-module

ChangeSet 1.925, 2002/11/27 15:09:52-08:00, greg@kroah.com

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


diff -Nru a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
--- a/fs/hugetlbfs/inode.c	Wed Nov 27 15:18:16 2002
+++ b/fs/hugetlbfs/inode.c	Wed Nov 27 15:18:16 2002
@@ -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;
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] More LSM changes for 2.5.49
  2002-11-28  0:26 ` [PATCH] " Greg KH
@ 2002-11-28  0:27   ` Greg KH
  2002-11-28  0:28     ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2002-11-28  0:27 UTC (permalink / raw)
  To: linux-kernel, linux-security-module

ChangeSet 1.926, 2002/11/27 15:11:25-08:00, greg@kroah.com

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


diff -Nru a/fs/attr.c b/fs/attr.c
--- a/fs/attr.c	Wed Nov 27 15:18:10 2002
+++ b/fs/attr.c	Wed Nov 27 15:18:10 2002
@@ -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);
diff -Nru a/fs/dquot.c b/fs/dquot.c
--- a/fs/dquot.c	Wed Nov 27 15:18:10 2002
+++ b/fs/dquot.c	Wed Nov 27 15:18:10 2002
@@ -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;
diff -Nru a/fs/exec.c b/fs/exec.c
--- a/fs/exec.c	Wed Nov 27 15:18:10 2002
+++ b/fs/exec.c	Wed Nov 27 15:18:10 2002
@@ -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);
diff -Nru a/fs/fcntl.c b/fs/fcntl.c
--- a/fs/fcntl.c	Wed Nov 27 15:18:10 2002
+++ b/fs/fcntl.c	Wed Nov 27 15:18:10 2002
@@ -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;
 	}
diff -Nru a/fs/ioctl.c b/fs/ioctl.c
--- a/fs/ioctl.c	Wed Nov 27 15:18:10 2002
+++ b/fs/ioctl.c	Wed Nov 27 15:18:10 2002
@@ -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;
         }
diff -Nru a/fs/locks.c b/fs/locks.c
--- a/fs/locks.c	Wed Nov 27 15:18:10 2002
+++ b/fs/locks.c	Wed Nov 27 15:18:10 2002
@@ -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) {
diff -Nru a/fs/namei.c b/fs/namei.c
--- a/fs/namei.c	Wed Nov 27 15:18:10 2002
+++ b/fs/namei.c	Wed Nov 27 15:18:10 2002
@@ -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);
diff -Nru a/fs/namespace.c b/fs/namespace.c
--- a/fs/namespace.c	Wed Nov 27 15:18:10 2002
+++ b/fs/namespace.c	Wed Nov 27 15:18:10 2002
@@ -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;
 	}
diff -Nru a/fs/open.c b/fs/open.c
--- a/fs/open.c	Wed Nov 27 15:18:10 2002
+++ b/fs/open.c	Wed Nov 27 15:18:10 2002
@@ -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);
 		}
diff -Nru a/fs/read_write.c b/fs/read_write.c
--- a/fs/read_write.c	Wed Nov 27 15:18:10 2002
+++ b/fs/read_write.c	Wed Nov 27 15:18:10 2002
@@ -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
diff -Nru a/fs/readdir.c b/fs/readdir.c
--- a/fs/readdir.c	Wed Nov 27 15:18:10 2002
+++ b/fs/readdir.c	Wed Nov 27 15:18:10 2002
@@ -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);
diff -Nru a/fs/stat.c b/fs/stat.c
--- a/fs/stat.c	Wed Nov 27 15:18:10 2002
+++ b/fs/stat.c	Wed Nov 27 15:18:10 2002
@@ -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);
 			}
diff -Nru a/fs/xattr.c b/fs/xattr.c
--- a/fs/xattr.c	Wed Nov 27 15:18:10 2002
+++ b/fs/xattr.c	Wed Nov 27 15:18:10 2002
@@ -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);

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] More LSM changes for 2.5.49
  2002-11-28  0:27   ` Greg KH
@ 2002-11-28  0:28     ` Greg KH
  2002-11-28  0:28       ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2002-11-28  0:28 UTC (permalink / raw)
  To: linux-kernel, linux-security-module

ChangeSet 1.927, 2002/11/27 15:12:52-08:00, greg@kroah.com

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


diff -Nru a/ipc/msg.c b/ipc/msg.c
--- a/ipc/msg.c	Wed Nov 27 15:18:04 2002
+++ b/ipc/msg.c	Wed Nov 27 15:18:04 2002
@@ -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;
 	}
diff -Nru a/ipc/sem.c b/ipc/sem.c
--- a/ipc/sem.c	Wed Nov 27 15:18:04 2002
+++ b/ipc/sem.c	Wed Nov 27 15:18:04 2002
@@ -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;
 	}
diff -Nru a/ipc/shm.c b/ipc/shm.c
--- a/ipc/shm.c	Wed Nov 27 15:18:04 2002
+++ b/ipc/shm.c	Wed Nov 27 15:18:04 2002
@@ -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;
 	}
diff -Nru a/mm/mmap.c b/mm/mmap.c
--- a/mm/mmap.c	Wed Nov 27 15:18:04 2002
+++ b/mm/mmap.c	Wed Nov 27 15:18:04 2002
@@ -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 */
diff -Nru a/mm/mprotect.c b/mm/mprotect.c
--- a/mm/mprotect.c	Wed Nov 27 15:18:04 2002
+++ b/mm/mprotect.c	Wed Nov 27 15:18:04 2002
@@ -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) {
diff -Nru a/net/core/scm.c b/net/core/scm.c
--- a/net/core/scm.c	Wed Nov 27 15:18:04 2002
+++ b/net/core/scm.c	Wed Nov 27 15:18:04 2002
@@ -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)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] More LSM changes for 2.5.49
  2002-11-28  0:28     ` Greg KH
@ 2002-11-28  0:28       ` Greg KH
  2002-11-28  0:28         ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2002-11-28  0:28 UTC (permalink / raw)
  To: linux-kernel, linux-security-module

ChangeSet 1.928, 2002/11/27 15:13:40-08:00, greg@kroah.com

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


diff -Nru a/kernel/acct.c b/kernel/acct.c
--- a/kernel/acct.c	Wed Nov 27 15:17:58 2002
+++ b/kernel/acct.c	Wed Nov 27 15:17:58 2002
@@ -223,7 +223,8 @@
 		}
 	}
 
-	if ((error = security_acct(file)))
+	error = security_acct(file);
+	if (error)
 		return error;
 
 	spin_lock(&acct_globals.lock);
diff -Nru a/kernel/fork.c b/kernel/fork.c
--- a/kernel/fork.c	Wed Nov 27 15:17:58 2002
+++ b/kernel/fork.c	Wed Nov 27 15:17:58 2002
@@ -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;
diff -Nru a/kernel/ptrace.c b/kernel/ptrace.c
--- a/kernel/ptrace.c	Wed Nov 27 15:17:58 2002
+++ b/kernel/ptrace.c	Wed Nov 27 15:17:58 2002
@@ -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 */
diff -Nru a/kernel/sched.c b/kernel/sched.c
--- a/kernel/sched.c	Wed Nov 27 15:17:58 2002
+++ b/kernel/sched.c	Wed Nov 27 15:17:58 2002
@@ -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 ?
diff -Nru a/kernel/signal.c b/kernel/signal.c
--- a/kernel/signal.c	Wed Nov 27 15:17:58 2002
+++ b/kernel/signal.c	Wed Nov 27 15:17:58 2002
@@ -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.
diff -Nru a/kernel/sys.c b/kernel/sys.c
--- a/kernel/sys.c	Wed Nov 27 15:17:58 2002
+++ b/kernel/sys.c	Wed Nov 27 15:17:58 2002
@@ -485,7 +485,8 @@
 	int new_egid = old_egid;
 	int retval;
 
-	if ((retval = security_task_setgid(rgid, egid, (gid_t)-1, LSM_SETID_RE)))
+	retval = security_task_setgid(rgid, egid, (gid_t)-1, LSM_SETID_RE);
+	if (retval)
 		return retval;
 
 	if (rgid != (gid_t) -1) {
@@ -530,7 +531,8 @@
 	int old_egid = current->egid;
 	int retval;
 
-	if ((retval = security_task_setgid(gid, (gid_t)-1, (gid_t)-1, LSM_SETID_ID)))
+	retval = security_task_setgid(gid, (gid_t)-1, (gid_t)-1, LSM_SETID_ID);
+	if (retval)
 		return retval;
 
 	if (capable(CAP_SETGID))
@@ -603,7 +605,8 @@
 	int old_ruid, old_euid, old_suid, new_ruid, new_euid;
 	int retval;
 
-	if ((retval = security_task_setuid(ruid, euid, (uid_t)-1, LSM_SETID_RE)))
+	retval = security_task_setuid(ruid, euid, (uid_t)-1, LSM_SETID_RE);
+	if (retval)
 		return retval;
 
 	new_ruid = old_ruid = current->uid;
@@ -663,7 +666,8 @@
 	int old_ruid, old_suid, new_ruid, new_suid;
 	int retval;
 
-	if ((retval = security_task_setuid(uid, (uid_t)-1, (uid_t)-1, LSM_SETID_ID)))
+	retval = security_task_setuid(uid, (uid_t)-1, (uid_t)-1, LSM_SETID_ID);
+	if (retval)
 		return retval;
 
 	old_ruid = new_ruid = current->uid;
@@ -700,7 +704,8 @@
 	int old_suid = current->suid;
 	int retval;
 
-	if ((retval = security_task_setuid(ruid, euid, suid, LSM_SETID_RES)))
+	retval = security_task_setuid(ruid, euid, suid, LSM_SETID_RES);
+	if (retval)
 		return retval;
 
 	if (!capable(CAP_SETUID)) {
@@ -751,7 +756,8 @@
 {
 	int retval;
 
-	if ((retval = security_task_setgid(rgid, egid, sgid, LSM_SETID_RES)))
+	retval = security_task_setgid(rgid, egid, sgid, LSM_SETID_RES);
+	if (retval)
 		return retval;
 
 	if (!capable(CAP_SETGID)) {
@@ -804,7 +810,8 @@
 	int old_fsuid;
 	int retval;
 
-	if ((retval = security_task_setuid(uid, (uid_t)-1, (uid_t)-1, LSM_SETID_FS)))
+	retval = security_task_setuid(uid, (uid_t)-1, (uid_t)-1, LSM_SETID_FS);
+	if (retval)
 		return retval;
 
 	old_fsuid = current->fsuid;
@@ -820,7 +827,8 @@
 		current->fsuid = uid;
 	}
 
-	if ((retval = security_task_post_setuid(old_fsuid, (uid_t)-1, (uid_t)-1, LSM_SETID_FS)))
+	retval = security_task_post_setuid(old_fsuid, (uid_t)-1, (uid_t)-1, LSM_SETID_FS);
+	if (retval)
 		return retval;
 
 	return old_fsuid;
@@ -834,7 +842,8 @@
 	int old_fsgid;
 	int retval;
 
-	if ((retval = security_task_setgid(gid, (gid_t)-1, (gid_t)-1, LSM_SETID_FS)))
+	retval = security_task_setgid(gid, (gid_t)-1, (gid_t)-1, LSM_SETID_FS);
+	if (retval)
 		return retval;
 
 	old_fsgid = current->fsgid;
@@ -959,7 +968,8 @@
 
 		retval = -ESRCH;
 		if (p) {
-			if (!(retval = security_task_getpgid(p)))
+			retval = security_task_getpgid(p);
+			if (!retval)
 				retval = p->pgrp;
 		}
 		read_unlock(&tasklist_lock);
@@ -986,7 +996,8 @@
 
 		retval = -ESRCH;
 		if(p) {
-			if (!(retval = security_task_getsid(p)))
+			retval = security_task_getsid(p);
+			if (!retval)
 				retval = p->session;
 		}
 		read_unlock(&tasklist_lock);
@@ -1067,7 +1078,8 @@
 		return -EINVAL;
 	if(copy_from_user(groups, grouplist, gidsetsize * sizeof(gid_t)))
 		return -EFAULT;
-	if ((retval = security_task_setgroups(gidsetsize, groups)))
+	retval = security_task_setgroups(gidsetsize, groups);
+	if (retval)
 		return retval;
 	memcpy(current->groups, groups, gidsetsize * sizeof(gid_t));
 	current->ngroups = gidsetsize;
@@ -1230,7 +1242,8 @@
 			return -EPERM;
 	}
 
-	if ((retval = security_task_setrlimit(resource, &new_rlim)))
+	retval = security_task_setrlimit(resource, &new_rlim);
+	if (retval)
 		return retval;
 
 	*old_rlim = new_rlim;
@@ -1304,7 +1317,8 @@
 	int error = 0;
 	int sig;
 
-	if ((error = security_task_prctl(option, arg2, arg3, arg4, arg5)))
+	error = security_task_prctl(option, arg2, arg3, arg4, arg5);
+	if (error)
 		return error;
 
 	switch (option) {
diff -Nru a/kernel/uid16.c b/kernel/uid16.c
--- a/kernel/uid16.c	Wed Nov 27 15:17:58 2002
+++ b/kernel/uid16.c	Wed Nov 27 15:17:58 2002
@@ -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;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] More LSM changes for 2.5.49
  2002-11-28  0:28       ` Greg KH
@ 2002-11-28  0:28         ` Greg KH
  0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2002-11-28  0:28 UTC (permalink / raw)
  To: linux-kernel, linux-security-module

ChangeSet 1.929, 2002/11/27 15:14:22-08:00, greg@kroah.com

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


diff -Nru a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
--- a/arch/arm/kernel/ptrace.c	Wed Nov 27 15:17:52 2002
+++ b/arch/arm/kernel/ptrace.c	Wed Nov 27 15:17:52 2002
@@ -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;
diff -Nru a/arch/i386/kernel/ptrace.c b/arch/i386/kernel/ptrace.c
--- a/arch/i386/kernel/ptrace.c	Wed Nov 27 15:17:52 2002
+++ b/arch/i386/kernel/ptrace.c	Wed Nov 27 15:17:52 2002
@@ -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;
diff -Nru a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c
--- a/arch/ia64/kernel/ptrace.c	Wed Nov 27 15:17:53 2002
+++ b/arch/ia64/kernel/ptrace.c	Wed Nov 27 15:17:53 2002
@@ -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;
diff -Nru a/arch/ppc/kernel/ptrace.c b/arch/ppc/kernel/ptrace.c
--- a/arch/ppc/kernel/ptrace.c	Wed Nov 27 15:17:52 2002
+++ b/arch/ppc/kernel/ptrace.c	Wed Nov 27 15:17:52 2002
@@ -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;
diff -Nru a/arch/ppc64/kernel/ptrace.c b/arch/ppc64/kernel/ptrace.c
--- a/arch/ppc64/kernel/ptrace.c	Wed Nov 27 15:17:52 2002
+++ b/arch/ppc64/kernel/ptrace.c	Wed Nov 27 15:17:52 2002
@@ -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;
diff -Nru a/arch/ppc64/kernel/ptrace32.c b/arch/ppc64/kernel/ptrace32.c
--- a/arch/ppc64/kernel/ptrace32.c	Wed Nov 27 15:17:52 2002
+++ b/arch/ppc64/kernel/ptrace32.c	Wed Nov 27 15:17:52 2002
@@ -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;
diff -Nru a/arch/ppc64/kernel/sys_ppc32.c b/arch/ppc64/kernel/sys_ppc32.c
--- a/arch/ppc64/kernel/sys_ppc32.c	Wed Nov 27 15:17:52 2002
+++ b/arch/ppc64/kernel/sys_ppc32.c	Wed Nov 27 15:17:52 2002
@@ -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);
diff -Nru a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
--- a/arch/s390/kernel/ptrace.c	Wed Nov 27 15:17:52 2002
+++ b/arch/s390/kernel/ptrace.c	Wed Nov 27 15:17:52 2002
@@ -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;
diff -Nru a/arch/s390x/kernel/ptrace.c b/arch/s390x/kernel/ptrace.c
--- a/arch/s390x/kernel/ptrace.c	Wed Nov 27 15:17:52 2002
+++ b/arch/s390x/kernel/ptrace.c	Wed Nov 27 15:17:52 2002
@@ -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;
diff -Nru a/arch/sparc/kernel/ptrace.c b/arch/sparc/kernel/ptrace.c
--- a/arch/sparc/kernel/ptrace.c	Wed Nov 27 15:17:53 2002
+++ b/arch/sparc/kernel/ptrace.c	Wed Nov 27 15:17:53 2002
@@ -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;
 		}
diff -Nru a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c
--- a/arch/sparc64/kernel/ptrace.c	Wed Nov 27 15:17:53 2002
+++ b/arch/sparc64/kernel/ptrace.c	Wed Nov 27 15:17:53 2002
@@ -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;
 		}
diff -Nru a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
--- a/arch/sparc64/kernel/sys_sparc32.c	Wed Nov 27 15:17:52 2002
+++ b/arch/sparc64/kernel/sys_sparc32.c	Wed Nov 27 15:17:52 2002
@@ -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);
diff -Nru a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c
--- a/arch/um/kernel/ptrace.c	Wed Nov 27 15:17:52 2002
+++ b/arch/um/kernel/ptrace.c	Wed Nov 27 15:17:52 2002
@@ -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. */
diff -Nru a/arch/x86_64/kernel/ptrace.c b/arch/x86_64/kernel/ptrace.c
--- a/arch/x86_64/kernel/ptrace.c	Wed Nov 27 15:17:52 2002
+++ b/arch/x86_64/kernel/ptrace.c	Wed Nov 27 15:17:52 2002
@@ -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;

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-11-28  0:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-27 23:06 [BK PATCH] More LSM changes for 2.5.49 Greg KH
2002-11-28  0:26 ` [PATCH] " Greg KH
2002-11-28  0:27   ` Greg KH
2002-11-28  0:28     ` Greg KH
2002-11-28  0:28       ` Greg KH
2002-11-28  0:28         ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.