Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf
authorDavid S. Miller <davem@davemloft.net>
Tue, 28 Apr 2015 03:12:34 +0000 (23:12 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 28 Apr 2015 03:12:34 +0000 (23:12 -0400)
Pablo Neira Ayuso says:

====================
Netfilter fixes for net

The following patchset contains Netfilter fixes for your net tree,
they are:

1) Fix a crash in nf_tables when dictionaries are used from the ruleset,
   due to memory corruption, from Florian Westphal.

2) Fix another crash in nf_queue when used with br_netfilter. Also from
   Florian.

Both fixes are related to new stuff that got in 4.0-rc.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netfilter_bridge.h
net/netfilter/nf_tables_api.c

index ab8f76d..f2fdb5a 100644 (file)
@@ -39,12 +39,24 @@ static inline void br_drop_fake_rtable(struct sk_buff *skb)
 
 static inline int nf_bridge_get_physinif(const struct sk_buff *skb)
 {
-       return skb->nf_bridge ? skb->nf_bridge->physindev->ifindex : 0;
+       struct nf_bridge_info *nf_bridge;
+
+       if (skb->nf_bridge == NULL)
+               return 0;
+
+       nf_bridge = skb->nf_bridge;
+       return nf_bridge->physindev ? nf_bridge->physindev->ifindex : 0;
 }
 
 static inline int nf_bridge_get_physoutif(const struct sk_buff *skb)
 {
-       return skb->nf_bridge ? skb->nf_bridge->physoutdev->ifindex : 0;
+       struct nf_bridge_info *nf_bridge;
+
+       if (skb->nf_bridge == NULL)
+               return 0;
+
+       nf_bridge = skb->nf_bridge;
+       return nf_bridge->physoutdev ? nf_bridge->physoutdev->ifindex : 0;
 }
 
 static inline struct net_device *
index 78af83b..ad9d11f 100644 (file)
@@ -4340,7 +4340,6 @@ static int nft_verdict_init(const struct nft_ctx *ctx, struct nft_data *data,
        case NFT_CONTINUE:
        case NFT_BREAK:
        case NFT_RETURN:
-               desc->len = sizeof(data->verdict);
                break;
        case NFT_JUMP:
        case NFT_GOTO:
@@ -4355,10 +4354,10 @@ static int nft_verdict_init(const struct nft_ctx *ctx, struct nft_data *data,
 
                chain->use++;
                data->verdict.chain = chain;
-               desc->len = sizeof(data);
                break;
        }
 
+       desc->len = sizeof(data->verdict);
        desc->type = NFT_DATA_VERDICT;
        return 0;
 }