bonding: correctly handle out of range parameters for lp_interval
authorSasha Levin <sasha.levin@oracle.com>
Thu, 6 Mar 2014 21:53:11 +0000 (16:53 -0500)
committerDavid S. Miller <davem@davemloft.net>
Thu, 6 Mar 2014 22:06:17 +0000 (17:06 -0500)
We didn't correctly check cases where the value for lp_interval is not
within the legal range due to a missing table terminator.

This would let userspace trigger a kernel panic by specifying a value out
of range:

echo -1 > /sys/devices/virtual/net/bond0/bonding/lp_interval

Introduced by commit 4325b374f84 ("bonding: convert lp_interval to use
the new option API").

Acked-by: Nikolay Aleksandrov <nikolay@redhat.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_options.c

index c378784327172a327bfc55a8cc4ee8737db93b43..298c26509095cdd6a6306aa954fe79b1ba46622b 100644 (file)
@@ -121,6 +121,7 @@ static struct bond_opt_value bond_resend_igmp_tbl[] = {
 static struct bond_opt_value bond_lp_interval_tbl[] = {
        { "minval",  1,       BOND_VALFLAG_MIN | BOND_VALFLAG_DEFAULT},
        { "maxval",  INT_MAX, BOND_VALFLAG_MAX},
+       { NULL,      -1,      0},
 };
 
 static struct bond_option bond_opts[] = {