ipc: Directly call the security hook in ipc_ops.associate
authorEric W. Biederman <ebiederm@xmission.com>
Sat, 24 Mar 2018 04:41:55 +0000 (23:41 -0500)
committerEric W. Biederman <ebiederm@xmission.com>
Tue, 27 Mar 2018 20:53:56 +0000 (15:53 -0500)
After the last round of cleanups the shm, sem, and msg associate
operations just became trivial wrappers around the appropriate security
method.  Simplify things further by just calling the security method
directly.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
ipc/msg.c
ipc/sem.c
ipc/shm.c

index 825ad585a6fff22fb55bc588bd0f28b71b424935..d667dd8e97ab09fdca5f82c9b7e046e42633108d 100644 (file)
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -272,20 +272,12 @@ static void freeque(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp)
        ipc_rcu_putref(&msq->q_perm, msg_rcu_free);
 }
 
-/*
- * Called with msg_ids.rwsem and ipcp locked.
- */
-static inline int msg_security(struct kern_ipc_perm *ipcp, int msgflg)
-{
-       return security_msg_queue_associate(ipcp, msgflg);
-}
-
 SYSCALL_DEFINE2(msgget, key_t, key, int, msgflg)
 {
        struct ipc_namespace *ns;
        static const struct ipc_ops msg_ops = {
                .getnew = newque,
-               .associate = msg_security,
+               .associate = security_msg_queue_associate,
        };
        struct ipc_params msg_params;
 
index 47b263960524b1ad738affb629e39e85d9de1f63..09d54af076a4cf8b1c0eb1adcd6d449e604ce051 100644 (file)
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -564,14 +564,6 @@ static int newary(struct ipc_namespace *ns, struct ipc_params *params)
 }
 
 
-/*
- * Called with sem_ids.rwsem and ipcp locked.
- */
-static inline int sem_security(struct kern_ipc_perm *ipcp, int semflg)
-{
-       return security_sem_associate(ipcp, semflg);
-}
-
 /*
  * Called with sem_ids.rwsem and ipcp locked.
  */
@@ -592,7 +584,7 @@ SYSCALL_DEFINE3(semget, key_t, key, int, nsems, int, semflg)
        struct ipc_namespace *ns;
        static const struct ipc_ops sem_ops = {
                .getnew = newary,
-               .associate = sem_security,
+               .associate = security_sem_associate,
                .more_checks = sem_more_checks,
        };
        struct ipc_params sem_params;
index 932b7e411c6ce9d3faef419900bd1efe18979b04..018db3d0e70ecd98596bc8cac73ec4a81af273c8 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -656,14 +656,6 @@ no_file:
        return error;
 }
 
-/*
- * Called with shm_ids.rwsem and ipcp locked.
- */
-static inline int shm_security(struct kern_ipc_perm *ipcp, int shmflg)
-{
-       return security_shm_associate(ipcp, shmflg);
-}
-
 /*
  * Called with shm_ids.rwsem and ipcp locked.
  */
@@ -684,7 +676,7 @@ SYSCALL_DEFINE3(shmget, key_t, key, size_t, size, int, shmflg)
        struct ipc_namespace *ns;
        static const struct ipc_ops shm_ops = {
                .getnew = newseg,
-               .associate = shm_security,
+               .associate = security_shm_associate,
                .more_checks = shm_more_checks,
        };
        struct ipc_params shm_params;