aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'ipc/util.c')
-rw-r--r--ipc/util.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ipc/util.c b/ipc/util.c
index 5e785a29e1e6..8193299f45f6 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -10,6 +10,8 @@
10 * Manfred Spraul <manfred@colorfullife.com> 10 * Manfred Spraul <manfred@colorfullife.com>
11 * Oct 2002 - One lock per IPC id. RCU ipc_free for lock-free grow_ary(). 11 * Oct 2002 - One lock per IPC id. RCU ipc_free for lock-free grow_ary().
12 * Mingming Cao <cmm@us.ibm.com> 12 * Mingming Cao <cmm@us.ibm.com>
13 * Mar 2006 - support for audit of ipc object properties
14 * Dustin Kirkland <dustin.kirkland@us.ibm.com>
13 */ 15 */
14 16
15#include <linux/config.h> 17#include <linux/config.h>
@@ -27,6 +29,7 @@
27#include <linux/workqueue.h> 29#include <linux/workqueue.h>
28#include <linux/seq_file.h> 30#include <linux/seq_file.h>
29#include <linux/proc_fs.h> 31#include <linux/proc_fs.h>
32#include <linux/audit.h>
30 33
31#include <asm/unistd.h> 34#include <asm/unistd.h>
32 35
@@ -183,8 +186,7 @@ static int grow_ary(struct ipc_ids* ids, int newsize)
183 if(new == NULL) 186 if(new == NULL)
184 return size; 187 return size;
185 new->size = newsize; 188 new->size = newsize;
186 memcpy(new->p, ids->entries->p, sizeof(struct kern_ipc_perm *)*size + 189 memcpy(new->p, ids->entries->p, sizeof(struct kern_ipc_perm *)*size);
187 sizeof(struct ipc_id_ary));
188 for(i=size;i<newsize;i++) { 190 for(i=size;i<newsize;i++) {
189 new->p[i] = NULL; 191 new->p[i] = NULL;
190 } 192 }
@@ -465,8 +467,10 @@ void ipc_rcu_putref(void *ptr)
465 467
466int ipcperms (struct kern_ipc_perm *ipcp, short flag) 468int ipcperms (struct kern_ipc_perm *ipcp, short flag)
467{ /* flag will most probably be 0 or S_...UGO from <linux/stat.h> */ 469{ /* flag will most probably be 0 or S_...UGO from <linux/stat.h> */
468 int requested_mode, granted_mode; 470 int requested_mode, granted_mode, err;
469 471
472 if (unlikely((err = audit_ipc_obj(ipcp))))
473 return err;
470 requested_mode = (flag >> 6) | (flag >> 3) | flag; 474 requested_mode = (flag >> 6) | (flag >> 3) | flag;
471 granted_mode = ipcp->mode; 475 granted_mode = ipcp->mode;
472 if (current->euid == ipcp->cuid || current->euid == ipcp->uid) 476 if (current->euid == ipcp->cuid || current->euid == ipcp->uid)