]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/ipv4/ipmr.c
net: ipmr/ip6mr: fix potential out-of-bounds vif_table access
[net-next-2.6.git] / net / ipv4 / ipmr.c
index 54596f73eff5a8f78e1abed5ab1dcb0777b775ff..0b9d03c54dc3a4f9930f122bd7e173e103709972 100644 (file)
@@ -802,6 +802,9 @@ static int ipmr_mfc_add(struct net *net, struct mfcctl *mfc, int mrtsock)
        int line;
        struct mfc_cache *uc, *c, **cp;
 
+       if (mfc->mfcc_parent >= MAXVIFS)
+               return -ENFILE;
+
        line = MFC_HASH(mfc->mfcc_mcastgrp.s_addr, mfc->mfcc_origin.s_addr);
 
        for (cp = &net->ipv4.mfc_cache_array[line];
@@ -1163,9 +1166,6 @@ static int ipmr_device_event(struct notifier_block *this, unsigned long event, v
        int ct;
        LIST_HEAD(list);
 
-       if (!net_eq(dev_net(dev), net))
-               return NOTIFY_DONE;
-
        if (event != NETDEV_UNREGISTER)
                return NOTIFY_DONE;
        v = &net->ipv4.vif_table[0];