aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/oki-semi
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2012-02-29 16:17:08 -0500
committerDavid S. Miller <davem@davemloft.net>2012-03-01 17:23:42 -0500
commit73f98eab9b9e0bab492ca06add5657d9e702ddb1 (patch)
treeea1fd7e0d1cc84812f950b00c30fae6208ce2488 /drivers/net/ethernet/oki-semi
parent1e804aecd7d447d9a939a9376603008af65e52a0 (diff)
pch_gbe: memory corruption calling pch_gbe_validate_option()
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>
Diffstat (limited to 'drivers/net/ethernet/oki-semi')
-rw-r--r--drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c
index 9cb5f912e489..29e23bec809c 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c
@@ -321,10 +321,10 @@ static void pch_gbe_check_copper_options(struct pch_gbe_adapter *adapter)
321 pr_debug("AutoNeg specified along with Speed or Duplex, AutoNeg parameter ignored\n"); 321 pr_debug("AutoNeg specified along with Speed or Duplex, AutoNeg parameter ignored\n");
322 hw->phy.autoneg_advertised = opt.def; 322 hw->phy.autoneg_advertised = opt.def;
323 } else { 323 } else {
324 hw->phy.autoneg_advertised = AutoNeg; 324 int tmp = AutoNeg;
325 pch_gbe_validate_option( 325
326 (int *)(&hw->phy.autoneg_advertised), 326 pch_gbe_validate_option(&tmp, &opt, adapter);
327 &opt, adapter); 327 hw->phy.autoneg_advertised = tmp;
328 } 328 }
329 } 329 }
330 330
@@ -495,9 +495,10 @@ void pch_gbe_check_options(struct pch_gbe_adapter *adapter)
495 .arg = { .l = { .nr = (int)ARRAY_SIZE(fc_list), 495 .arg = { .l = { .nr = (int)ARRAY_SIZE(fc_list),
496 .p = fc_list } } 496 .p = fc_list } }
497 }; 497 };
498 hw->mac.fc = FlowControl; 498 int tmp = FlowControl;
499 pch_gbe_validate_option((int *)(&hw->mac.fc), 499
500 &opt, adapter); 500 pch_gbe_validate_option(&tmp, &opt, adapter);
501 hw->mac.fc = tmp;
501 } 502 }
502 503
503 pch_gbe_check_copper_options(adapter); 504 pch_gbe_check_copper_options(adapter);