|
|
|
Re: Promiscuity counter underflow | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
|
Hi Emmanuel,
right, since it is checked for overflows, a misuse of this function
the other way round could end in a
mess, too. What do you think David?
2010/5/11 Emmanuel Roullit <emmanuel@xxxxxxxxxxxxxxx>:
> Signed-off-by: Emmanuel Roullit <emmanuel@xxxxxxxxxxxxxxx>
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index f769098..f49dbde 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -3591,6 +3591,13 @@ static int __dev_set_promiscuity(struct net_device *dev, int inc)
>
> ASSERT_RTNL();
>
> + if (inc < 0 && -inc > dev->promiscuity) {
> + printk(KERN_WARNING "%s: promiscuity touches bottom, "
> + "set promiscuity failed, promiscuity feature "
> + "of device might be broken.\n", dev->name);
> + return -EOVERFLOW;
> + }
> +
> dev->flags |= IFF_PROMISC;
> dev->promiscuity += inc;
> if (dev->promiscuity == 0) {
Cheers,
Daniel
--
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Netdev] [Ethernet Bridging] [Linux 802.1Q VLAN] [Linux Wireless] [Kernel Newbies] [Security] [Linux for Hams] [Netfilter] [Git] [Bugtraq] [Photo] [Yosemite] [Yosemite News and Information] [MIPS Linux] [ARM Linux] [Linux RAID] [Linux PCI] [Linux Admin] [Samba] [Video 4 Linux] [Linux Resources]