aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2012-02-29 16:17:08 -0500
committerLuis Henriques <luis.henriques@canonical.com>2012-05-25 12:24:51 -0400
commitaac81c0b73d65036a6f4c3d4d4983614d549ec28 (patch)
tree4d63d697c2b0f7e5c9b3f51c20e20e549192778a /drivers
parent15ebd6449a85ea528fab378e390330a04f88f6f8 (diff)
pch_gbe: memory corruption calling pch_gbe_validate_option()
BugLink: http://bugs.launchpad.net/bugs/1002880 commit 73f98eab9b9e0bab492ca06add5657d9e702ddb1 upstream. pch_gbe_validate_option() modifies 32 bits of memory but we pass &hw->phy.autoneg_advertised which only has 16 bits and &hw->mac.fc which only has 8 bits. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/pch_gbe/pch_gbe_param.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/net/pch_gbe/pch_gbe_param.c b/drivers/net/pch_gbe/pch_gbe_param.c
index 5b5d90a47e2..fb74ef9c81a 100644
--- a/drivers/net/pch_gbe/pch_gbe_param.c
+++ b/drivers/net/pch_gbe/pch_gbe_param.c
@@ -320,10 +320,10 @@ static void pch_gbe_check_copper_options(struct pch_gbe_adapter *adapter)
320 pr_debug("AutoNeg specified along with Speed or Duplex, AutoNeg parameter ignored\n"); 320 pr_debug("AutoNeg specified along with Speed or Duplex, AutoNeg parameter ignored\n");
321 hw->phy.autoneg_advertised = opt.def; 321 hw->phy.autoneg_advertised = opt.def;
322 } else { 322 } else {
323 hw->phy.autoneg_advertised = AutoNeg; 323 int tmp = AutoNeg;
324 pch_gbe_validate_option( 324
325 (int *)(&hw->phy.autoneg_advertised), 325 pch_gbe_validate_option(&tmp, &opt, adapter);
326 &opt, adapter); 326 hw->phy.autoneg_advertised = tmp;
327 } 327 }
328 } 328 }
329 329
@@ -494,9 +494,10 @@ void pch_gbe_check_options(struct pch_gbe_adapter *adapter)
494 .arg = { .l = { .nr = (int)ARRAY_SIZE(fc_list), 494 .arg = { .l = { .nr = (int)ARRAY_SIZE(fc_list),
495 .p = fc_list } } 495 .p = fc_list } }
496 }; 496 };
497 hw->mac.fc = FlowControl; 497 int tmp = FlowControl;
498 pch_gbe_validate_option((int *)(&hw->mac.fc), 498
499 &opt, adapter); 499 pch_gbe_validate_option(&tmp, &opt, adapter);
500 hw->mac.fc = tmp;
500 } 501 }
501 502
502 pch_gbe_check_copper_options(adapter); 503 pch_gbe_check_copper_options(adapter);