diff options
| author | Huw Davies <huw@codeweavers.com> | 2016-06-27 15:06:16 -0400 |
|---|---|---|
| committer | Paul Moore <paul@paul-moore.com> | 2016-06-27 15:06:16 -0400 |
| commit | a04e71f631fa3d2fd2aa0404c11484739d1e9073 (patch) | |
| tree | c69ef0d43baa723ea7c62d8e8e35faec0a5067ca /security/selinux | |
| parent | 2917f57b6bc15cc6787496ee5f2fdf17f0e9b7d3 (diff) | |
netlabel: Pass a family parameter to netlbl_skbuff_err().
This makes it possible to route the error to the appropriate
labelling engine. CALIPSO is far less verbose than CIPSO
when encountering a bogus packet, so there is no need for a
CALIPSO error handler.
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security/selinux')
| -rw-r--r-- | security/selinux/hooks.c | 6 | ||||
| -rw-r--r-- | security/selinux/include/netlabel.h | 4 | ||||
| -rw-r--r-- | security/selinux/netlabel.c | 6 |
3 files changed, 9 insertions, 7 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index cb7c5c8028e7..51eafe5d3bf4 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
| @@ -4603,13 +4603,13 @@ static int selinux_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
| 4603 | err = selinux_inet_sys_rcv_skb(sock_net(sk), skb->skb_iif, | 4603 | err = selinux_inet_sys_rcv_skb(sock_net(sk), skb->skb_iif, |
| 4604 | addrp, family, peer_sid, &ad); | 4604 | addrp, family, peer_sid, &ad); |
| 4605 | if (err) { | 4605 | if (err) { |
| 4606 | selinux_netlbl_err(skb, err, 0); | 4606 | selinux_netlbl_err(skb, family, err, 0); |
| 4607 | return err; | 4607 | return err; |
| 4608 | } | 4608 | } |
| 4609 | err = avc_has_perm(sk_sid, peer_sid, SECCLASS_PEER, | 4609 | err = avc_has_perm(sk_sid, peer_sid, SECCLASS_PEER, |
| 4610 | PEER__RECV, &ad); | 4610 | PEER__RECV, &ad); |
| 4611 | if (err) { | 4611 | if (err) { |
| 4612 | selinux_netlbl_err(skb, err, 0); | 4612 | selinux_netlbl_err(skb, family, err, 0); |
| 4613 | return err; | 4613 | return err; |
| 4614 | } | 4614 | } |
| 4615 | } | 4615 | } |
| @@ -4977,7 +4977,7 @@ static unsigned int selinux_ip_forward(struct sk_buff *skb, | |||
| 4977 | err = selinux_inet_sys_rcv_skb(dev_net(indev), indev->ifindex, | 4977 | err = selinux_inet_sys_rcv_skb(dev_net(indev), indev->ifindex, |
| 4978 | addrp, family, peer_sid, &ad); | 4978 | addrp, family, peer_sid, &ad); |
| 4979 | if (err) { | 4979 | if (err) { |
| 4980 | selinux_netlbl_err(skb, err, 1); | 4980 | selinux_netlbl_err(skb, family, err, 1); |
| 4981 | return NF_DROP; | 4981 | return NF_DROP; |
| 4982 | } | 4982 | } |
| 4983 | } | 4983 | } |
diff --git a/security/selinux/include/netlabel.h b/security/selinux/include/netlabel.h index 8c59b8f150e8..75686d53df07 100644 --- a/security/selinux/include/netlabel.h +++ b/security/selinux/include/netlabel.h | |||
| @@ -40,7 +40,8 @@ | |||
| 40 | #ifdef CONFIG_NETLABEL | 40 | #ifdef CONFIG_NETLABEL |
| 41 | void selinux_netlbl_cache_invalidate(void); | 41 | void selinux_netlbl_cache_invalidate(void); |
| 42 | 42 | ||
| 43 | void selinux_netlbl_err(struct sk_buff *skb, int error, int gateway); | 43 | void selinux_netlbl_err(struct sk_buff *skb, u16 family, int error, |
| 44 | int gateway); | ||
| 44 | 45 | ||
| 45 | void selinux_netlbl_sk_security_free(struct sk_security_struct *sksec); | 46 | void selinux_netlbl_sk_security_free(struct sk_security_struct *sksec); |
| 46 | void selinux_netlbl_sk_security_reset(struct sk_security_struct *sksec); | 47 | void selinux_netlbl_sk_security_reset(struct sk_security_struct *sksec); |
| @@ -72,6 +73,7 @@ static inline void selinux_netlbl_cache_invalidate(void) | |||
| 72 | } | 73 | } |
| 73 | 74 | ||
| 74 | static inline void selinux_netlbl_err(struct sk_buff *skb, | 75 | static inline void selinux_netlbl_err(struct sk_buff *skb, |
| 76 | u16 family, | ||
| 75 | int error, | 77 | int error, |
| 76 | int gateway) | 78 | int gateway) |
| 77 | { | 79 | { |
diff --git a/security/selinux/netlabel.c b/security/selinux/netlabel.c index ca220c3fbcf9..dfca50dc292a 100644 --- a/security/selinux/netlabel.c +++ b/security/selinux/netlabel.c | |||
| @@ -151,9 +151,9 @@ void selinux_netlbl_cache_invalidate(void) | |||
| 151 | * present on the packet, NetLabel is smart enough to only act when it should. | 151 | * present on the packet, NetLabel is smart enough to only act when it should. |
| 152 | * | 152 | * |
| 153 | */ | 153 | */ |
| 154 | void selinux_netlbl_err(struct sk_buff *skb, int error, int gateway) | 154 | void selinux_netlbl_err(struct sk_buff *skb, u16 family, int error, int gateway) |
| 155 | { | 155 | { |
| 156 | netlbl_skbuff_err(skb, error, gateway); | 156 | netlbl_skbuff_err(skb, family, error, gateway); |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | /** | 159 | /** |
| @@ -405,7 +405,7 @@ int selinux_netlbl_sock_rcv_skb(struct sk_security_struct *sksec, | |||
| 405 | return 0; | 405 | return 0; |
| 406 | 406 | ||
| 407 | if (nlbl_sid != SECINITSID_UNLABELED) | 407 | if (nlbl_sid != SECINITSID_UNLABELED) |
| 408 | netlbl_skbuff_err(skb, rc, 0); | 408 | netlbl_skbuff_err(skb, family, rc, 0); |
| 409 | return rc; | 409 | return rc; |
| 410 | } | 410 | } |
| 411 | 411 | ||
