Skip to content

Commit 50ab44b

Browse files
committed
ipc: Directly call the security hook in ipc_ops.associate
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" <[email protected]>
1 parent 51d6f26 commit 50ab44b

File tree

3 files changed

+3
-27
lines changed

3 files changed

+3
-27
lines changed

ipc/msg.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -272,20 +272,12 @@ static void freeque(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp)
272272
ipc_rcu_putref(&msq->q_perm, msg_rcu_free);
273273
}
274274

275-
/*
276-
* Called with msg_ids.rwsem and ipcp locked.
277-
*/
278-
static inline int msg_security(struct kern_ipc_perm *ipcp, int msgflg)
279-
{
280-
return security_msg_queue_associate(ipcp, msgflg);
281-
}
282-
283275
SYSCALL_DEFINE2(msgget, key_t, key, int, msgflg)
284276
{
285277
struct ipc_namespace *ns;
286278
static const struct ipc_ops msg_ops = {
287279
.getnew = newque,
288-
.associate = msg_security,
280+
.associate = security_msg_queue_associate,
289281
};
290282
struct ipc_params msg_params;
291283

ipc/sem.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -564,14 +564,6 @@ static int newary(struct ipc_namespace *ns, struct ipc_params *params)
564564
}
565565

566566

567-
/*
568-
* Called with sem_ids.rwsem and ipcp locked.
569-
*/
570-
static inline int sem_security(struct kern_ipc_perm *ipcp, int semflg)
571-
{
572-
return security_sem_associate(ipcp, semflg);
573-
}
574-
575567
/*
576568
* Called with sem_ids.rwsem and ipcp locked.
577569
*/
@@ -592,7 +584,7 @@ SYSCALL_DEFINE3(semget, key_t, key, int, nsems, int, semflg)
592584
struct ipc_namespace *ns;
593585
static const struct ipc_ops sem_ops = {
594586
.getnew = newary,
595-
.associate = sem_security,
587+
.associate = security_sem_associate,
596588
.more_checks = sem_more_checks,
597589
};
598590
struct ipc_params sem_params;

ipc/shm.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -656,14 +656,6 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
656656
return error;
657657
}
658658

659-
/*
660-
* Called with shm_ids.rwsem and ipcp locked.
661-
*/
662-
static inline int shm_security(struct kern_ipc_perm *ipcp, int shmflg)
663-
{
664-
return security_shm_associate(ipcp, shmflg);
665-
}
666-
667659
/*
668660
* Called with shm_ids.rwsem and ipcp locked.
669661
*/
@@ -684,7 +676,7 @@ SYSCALL_DEFINE3(shmget, key_t, key, size_t, size, int, shmflg)
684676
struct ipc_namespace *ns;
685677
static const struct ipc_ops shm_ops = {
686678
.getnew = newseg,
687-
.associate = shm_security,
679+
.associate = security_shm_associate,
688680
.more_checks = shm_more_checks,
689681
};
690682
struct ipc_params shm_params;

0 commit comments

Comments
 (0)