Commit ac46a4623815113a0305b2a491c125f473a88c53
Committed by
David S. Miller
1 parent
57dbf29a54
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
be2net: Missing byteswap in be_get_fw_log_level causes oops on PowerPC
We are seeing an oops in be_get_fw_log_level on ppc64 where we walk off the end of memory. commit 941a77d582c8 (be2net: Fix to allow get/set of debug levels in the firmware.) requires byteswapping of num_modes and num_modules. Cc: stable@vger.kernel.org # 3.5+ Signed-off-by: Anton Blanchard <anton@samba.org> Acked-by: Sathya Perla <sperla@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 2 changed files with 4 additions and 3 deletions Side-by-side Diff
drivers/net/ethernet/emulex/benet/be_ethtool.c
... | ... | @@ -910,8 +910,9 @@ |
910 | 910 | if (!status) { |
911 | 911 | cfgs = (struct be_fat_conf_params *)(extfat_cmd.va + |
912 | 912 | sizeof(struct be_cmd_resp_hdr)); |
913 | - for (i = 0; i < cfgs->num_modules; i++) { | |
914 | - for (j = 0; j < cfgs->module[i].num_modes; j++) { | |
913 | + for (i = 0; i < le32_to_cpu(cfgs->num_modules); i++) { | |
914 | + u32 num_modes = le32_to_cpu(cfgs->module[i].num_modes); | |
915 | + for (j = 0; j < num_modes; j++) { | |
915 | 916 | if (cfgs->module[i].trace_lvl[j].mode == |
916 | 917 | MODE_UART) |
917 | 918 | cfgs->module[i].trace_lvl[j].dbg_lvl = |
drivers/net/ethernet/emulex/benet/be_main.c
... | ... | @@ -3579,7 +3579,7 @@ |
3579 | 3579 | if (!status) { |
3580 | 3580 | cfgs = (struct be_fat_conf_params *)(extfat_cmd.va + |
3581 | 3581 | sizeof(struct be_cmd_resp_hdr)); |
3582 | - for (j = 0; j < cfgs->module[0].num_modes; j++) { | |
3582 | + for (j = 0; j < le32_to_cpu(cfgs->module[0].num_modes); j++) { | |
3583 | 3583 | if (cfgs->module[0].trace_lvl[j].mode == MODE_UART) |
3584 | 3584 | level = cfgs->module[0].trace_lvl[j].dbg_lvl; |
3585 | 3585 | } |