aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/broadcom
diff options
context:
space:
mode:
authorYuval Mintz <yuvalmin@broadcom.com>2014-01-05 11:33:53 -0500
committerDavid S. Miller <davem@davemloft.net>2014-01-05 20:22:25 -0500
commit9dfef3adaebb42163d691be73e05b12da440cbe5 (patch)
treef8989f46cdfb6901e0c07f344f9d4b5c23a9f7a4 /drivers/net/ethernet/broadcom
parent5b622918cd6f4ff5b5200ea6b2e48ae2fa6ad09e (diff)
bnx2x: fix AFEX memory overflow
There are 2 different (related) flows in the slowpath configuration that utilize the same pointer and cast it to different structs; This is obviously incorrect as the intended allocated memory is that of the smaller struct, possibly causing the flow utilizing the larger struct to corrupt other slowpath configuration. Since both flows are exclusive, set the allocated memory to be a union of both structs. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com> Signed-off-by: Ariel Elior <ariele@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom')
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index cb30d1a3d3ad..2d5fce4c9751 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -1250,7 +1250,10 @@ struct bnx2x_slowpath {
1250 * Therefore, if they would have been defined in the same union, 1250 * Therefore, if they would have been defined in the same union,
1251 * data can get corrupted. 1251 * data can get corrupted.
1252 */ 1252 */
1253 struct afex_vif_list_ramrod_data func_afex_rdata; 1253 union {
1254 struct afex_vif_list_ramrod_data viflist_data;
1255 struct function_update_data func_update;
1256 } func_afex_rdata;
1254 1257
1255 /* used by dmae command executer */ 1258 /* used by dmae command executer */
1256 struct dmae_command dmae[MAX_DMAE_C]; 1259 struct dmae_command dmae[MAX_DMAE_C];