SELinux: indicate fatal error in compat netfilter code
authorEric Paris <eparis@redhat.com>
Tue, 23 Nov 2010 06:28:08 +0000 (06:28 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 23 Nov 2010 18:50:17 +0000 (10:50 -0800)
The SELinux ip postroute code indicates when policy rejected a packet and
passes the error back up the stack.  The compat code does not.  This patch
sends the same kind of error back up the stack in the compat code.

Based-on-patch-by: Paul Moore <paul.moore@hp.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
Reviewed-by: Paul Moore <paul.moore@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
security/selinux/hooks.c

index f590fb8e91430909246213934b17970f827870c7..156ef93d6f7d8030e72b85822f13b597bfeb9736 100644 (file)
@@ -4524,11 +4524,11 @@ static unsigned int selinux_ip_postroute_compat(struct sk_buff *skb,
        if (selinux_secmark_enabled())
                if (avc_has_perm(sksec->sid, skb->secmark,
                                 SECCLASS_PACKET, PACKET__SEND, &ad))
-                       return NF_DROP;
+                       return NF_DROP_ERR(-ECONNREFUSED);
 
        if (selinux_policycap_netpeer)
                if (selinux_xfrm_postroute_last(sksec->sid, skb, &ad, proto))
-                       return NF_DROP;
+                       return NF_DROP_ERR(-ECONNREFUSED);
 
        return NF_ACCEPT;
 }