Commit c0315f4b authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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

parent ee099009
...@@ -101,7 +101,8 @@ static int newque (key_t key, int msgflg) ...@@ -101,7 +101,8 @@ static int newque (key_t key, int msgflg)
msq->q_perm.key = key; msq->q_perm.key = key;
msq->q_perm.security = NULL; 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)); ipc_rcu_free(msq, sizeof(*msq));
return retval; return retval;
} }
......
...@@ -136,7 +136,8 @@ static int newary (key_t key, int nsems, int semflg) ...@@ -136,7 +136,8 @@ static int newary (key_t key, int nsems, int semflg)
sma->sem_perm.key = key; sma->sem_perm.key = key;
sma->sem_perm.security = NULL; sma->sem_perm.security = NULL;
if ((retval = security_sem_alloc(sma))) { retval = security_sem_alloc(sma);
if (retval) {
ipc_rcu_free(sma, size); ipc_rcu_free(sma, size);
return retval; return retval;
} }
......
...@@ -188,7 +188,8 @@ static int newseg (key_t key, int shmflg, size_t size) ...@@ -188,7 +188,8 @@ static int newseg (key_t key, int shmflg, size_t size)
shp->shm_flags = (shmflg & S_IRWXUGO); shp->shm_flags = (shmflg & S_IRWXUGO);
shp->shm_perm.security = NULL; shp->shm_perm.security = NULL;
if ((error = security_shm_alloc(shp))) { error = security_shm_alloc(shp);
if (error) {
ipc_rcu_free(shp, sizeof(*shp)); ipc_rcu_free(shp, sizeof(*shp));
return error; return error;
} }
......
...@@ -504,7 +504,8 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr, ...@@ -504,7 +504,8 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
} }
} }
if ((error = security_file_mmap(file, prot, flags))) error = security_file_mmap(file, prot, flags);
if (error)
return error; return error;
/* Clear old maps */ /* Clear old maps */
......
...@@ -263,7 +263,8 @@ sys_mprotect(unsigned long start, size_t len, unsigned long prot) ...@@ -263,7 +263,8 @@ sys_mprotect(unsigned long start, size_t len, unsigned long prot)
goto out; goto out;
} }
if ((error = security_file_mprotect(vma, prot))) error = security_file_mprotect(vma, prot);
if (error)
goto out; goto out;
if (vma->vm_end > end) { if (vma->vm_end > end) {
......
...@@ -217,7 +217,8 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm) ...@@ -217,7 +217,8 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm)
for (i=0, cmfptr=(int*)CMSG_DATA(cm); i<fdmax; i++, cmfptr++) for (i=0, cmfptr=(int*)CMSG_DATA(cm); i<fdmax; i++, cmfptr++)
{ {
int new_fd; int new_fd;
if ((err = security_file_receive(fp[i]))) err = security_file_receive(fp[i]);
if (err)
break; break;
err = get_unused_fd(); err = get_unused_fd();
if (err < 0) if (err < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment