aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/hooks.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r--security/selinux/hooks.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 2ae7d3cb8df4..aae1e794fe48 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -2855,8 +2855,7 @@ static int selinux_parse_skb_ipv6(struct sk_buff *skb, struct avc_audit_data *ad
2855 2855
2856 nexthdr = ip6->nexthdr; 2856 nexthdr = ip6->nexthdr;
2857 offset += sizeof(_ipv6h); 2857 offset += sizeof(_ipv6h);
2858 offset = ipv6_skip_exthdr(skb, offset, &nexthdr, 2858 offset = ipv6_skip_exthdr(skb, offset, &nexthdr);
2859 skb->tail - skb->head - offset);
2860 if (offset < 0) 2859 if (offset < 0)
2861 goto out; 2860 goto out;
2862 2861
@@ -3668,7 +3667,7 @@ static void msg_msg_free_security(struct msg_msg *msg)
3668} 3667}
3669 3668
3670static int ipc_has_perm(struct kern_ipc_perm *ipc_perms, 3669static int ipc_has_perm(struct kern_ipc_perm *ipc_perms,
3671 u16 sclass, u32 perms) 3670 u32 perms)
3672{ 3671{
3673 struct task_security_struct *tsec; 3672 struct task_security_struct *tsec;
3674 struct ipc_security_struct *isec; 3673 struct ipc_security_struct *isec;
@@ -3680,7 +3679,7 @@ static int ipc_has_perm(struct kern_ipc_perm *ipc_perms,
3680 AVC_AUDIT_DATA_INIT(&ad, IPC); 3679 AVC_AUDIT_DATA_INIT(&ad, IPC);
3681 ad.u.ipc_id = ipc_perms->key; 3680 ad.u.ipc_id = ipc_perms->key;
3682 3681
3683 return avc_has_perm(tsec->sid, isec->sid, sclass, perms, &ad); 3682 return avc_has_perm(tsec->sid, isec->sid, isec->sclass, perms, &ad);
3684} 3683}
3685 3684
3686static int selinux_msg_msg_alloc_security(struct msg_msg *msg) 3685static int selinux_msg_msg_alloc_security(struct msg_msg *msg)
@@ -3765,7 +3764,7 @@ static int selinux_msg_queue_msgctl(struct msg_queue *msq, int cmd)
3765 return 0; 3764 return 0;
3766 } 3765 }
3767 3766
3768 err = ipc_has_perm(&msq->q_perm, SECCLASS_MSGQ, perms); 3767 err = ipc_has_perm(&msq->q_perm, perms);
3769 return err; 3768 return err;
3770} 3769}
3771 3770
@@ -3917,7 +3916,7 @@ static int selinux_shm_shmctl(struct shmid_kernel *shp, int cmd)
3917 return 0; 3916 return 0;
3918 } 3917 }
3919 3918
3920 err = ipc_has_perm(&shp->shm_perm, SECCLASS_SHM, perms); 3919 err = ipc_has_perm(&shp->shm_perm, perms);
3921 return err; 3920 return err;
3922} 3921}
3923 3922
@@ -3936,7 +3935,7 @@ static int selinux_shm_shmat(struct shmid_kernel *shp,
3936 else 3935 else
3937 perms = SHM__READ | SHM__WRITE; 3936 perms = SHM__READ | SHM__WRITE;
3938 3937
3939 return ipc_has_perm(&shp->shm_perm, SECCLASS_SHM, perms); 3938 return ipc_has_perm(&shp->shm_perm, perms);
3940} 3939}
3941 3940
3942/* Semaphore security operations */ 3941/* Semaphore security operations */
@@ -4025,7 +4024,7 @@ static int selinux_sem_semctl(struct sem_array *sma, int cmd)
4025 return 0; 4024 return 0;
4026 } 4025 }
4027 4026
4028 err = ipc_has_perm(&sma->sem_perm, SECCLASS_SEM, perms); 4027 err = ipc_has_perm(&sma->sem_perm, perms);
4029 return err; 4028 return err;
4030} 4029}
4031 4030
@@ -4039,18 +4038,13 @@ static int selinux_sem_semop(struct sem_array *sma,
4039 else 4038 else
4040 perms = SEM__READ; 4039 perms = SEM__READ;
4041 4040
4042 return ipc_has_perm(&sma->sem_perm, SECCLASS_SEM, perms); 4041 return ipc_has_perm(&sma->sem_perm, perms);
4043} 4042}
4044 4043
4045static int selinux_ipc_permission(struct kern_ipc_perm *ipcp, short flag) 4044static int selinux_ipc_permission(struct kern_ipc_perm *ipcp, short flag)
4046{ 4045{
4047 struct ipc_security_struct *isec = ipcp->security;
4048 u16 sclass = SECCLASS_IPC;
4049 u32 av = 0; 4046 u32 av = 0;
4050 4047
4051 if (isec && isec->magic == SELINUX_MAGIC)
4052 sclass = isec->sclass;
4053
4054 av = 0; 4048 av = 0;
4055 if (flag & S_IRUGO) 4049 if (flag & S_IRUGO)
4056 av |= IPC__UNIX_READ; 4050 av |= IPC__UNIX_READ;
@@ -4060,7 +4054,7 @@ static int selinux_ipc_permission(struct kern_ipc_perm *ipcp, short flag)
4060 if (av == 0) 4054 if (av == 0)
4061 return 0; 4055 return 0;
4062 4056
4063 return ipc_has_perm(ipcp, sclass, av); 4057 return ipc_has_perm(ipcp, av);
4064} 4058}
4065 4059
4066/* module stacking operations */ 4060/* module stacking operations */