From: Greg KH <gre...@linuxfoundation.org>

3.5-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Anton Blanchard <an...@samba.org>

commit ac46a4623815113a0305b2a491c125f473a88c53 upstream.

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.

Signed-off-by: Anton Blanchard <an...@samba.org>
Acked-by: Sathya Perla <spe...@emulex.com>
Signed-off-by: David S. Miller <da...@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>

---
 drivers/net/ethernet/emulex/benet/be_ethtool.c |    5 +++--
 drivers/net/ethernet/emulex/benet/be_main.c    |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

--- a/drivers/net/ethernet/emulex/benet/be_ethtool.c
+++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c
@@ -910,8 +910,9 @@ static void be_set_fw_log_level(struct b
        if (!status) {
                cfgs = (struct be_fat_conf_params *)(extfat_cmd.va +
                                        sizeof(struct be_cmd_resp_hdr));
-               for (i = 0; i < cfgs->num_modules; i++) {
-                       for (j = 0; j < cfgs->module[i].num_modes; j++) {
+               for (i = 0; i < le32_to_cpu(cfgs->num_modules); i++) {
+                       u32 num_modes = le32_to_cpu(cfgs->module[i].num_modes);
+                       for (j = 0; j < num_modes; j++) {
                                if (cfgs->module[i].trace_lvl[j].mode ==
                                                                MODE_UART)
                                        cfgs->module[i].trace_lvl[j].dbg_lvl =
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -3479,7 +3479,7 @@ u32 be_get_fw_log_level(struct be_adapte
        if (!status) {
                cfgs = (struct be_fat_conf_params *)(extfat_cmd.va +
                                                sizeof(struct be_cmd_resp_hdr));
-               for (j = 0; j < cfgs->module[0].num_modes; j++) {
+               for (j = 0; j < le32_to_cpu(cfgs->module[0].num_modes); j++) {
                        if (cfgs->module[0].trace_lvl[j].mode == MODE_UART)
                                level = cfgs->module[0].trace_lvl[j].dbg_lvl;
                }


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to