]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] SELinux: Fix error handling bug.
authorAndrew Morton <akpm@osdl.org>
Mon, 16 Feb 2004 02:06:53 +0000 (18:06 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Mon, 16 Feb 2004 02:06:53 +0000 (18:06 -0800)
From: James Morris <jmorris@redhat.com>

The patch below fixes an error handling flaw, where we need to return a
Netfilter verdict from the function rather than a standard error code.

security/selinux/hooks.c

index aa07acdf37a213518d46d06ef6baef01eac87402..8c0ea6a4ee3fb7ff8d0a06ef5ff398b4585b7092 100644 (file)
@@ -3179,8 +3179,9 @@ static unsigned int selinux_ip_postroute_last(unsigned int hooknum,
                
        /* Fixme: this lookup is inefficient */
        iph = skb->nh.iph;
-       err = security_node_sid(PF_INET, &iph->daddr, sizeof(iph->daddr), &node_sid);
-       if (err)
+       err = security_node_sid(PF_INET, &iph->daddr, sizeof(iph->daddr),
+                               &node_sid) ? NF_DROP : NF_ACCEPT;
+       if (err != NF_ACCEPT)
                goto out;
        
        err = avc_has_perm(isec->sid, node_sid, SECCLASS_NODE,