]> git.hungrycats.org Git - linux/commitdiff
iwlwifi: mvm: properly check for transport data in dump
authorJohannes Berg <johannes.berg@intel.com>
Thu, 20 Oct 2016 13:25:00 +0000 (15:25 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 14 May 2017 12:08:23 +0000 (14:08 +0200)
commit c2e27e16f2411155b906db201b7e478144034ffe upstream.

When copying from vmalloc'ed memory to the SG list, don't crash
if the transport didn't provide any data.

Fixes: 7e62a699aafb ("iwlwifi: mvm: use dev_coredumpsg()")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c

index 2e8e3e8e30a329afc9c5b962739990ebea97fb1e..067f67f74698bc59a8ae7fae0ba62b6162e04d45 100644 (file)
@@ -816,11 +816,12 @@ dump_trans_data:
                                     sg_nents(sg_dump_data),
                                     fw_error_dump->op_mode_ptr,
                                     fw_error_dump->op_mode_len, 0);
-               sg_pcopy_from_buffer(sg_dump_data,
-                                    sg_nents(sg_dump_data),
-                                    fw_error_dump->trans_ptr->data,
-                                    fw_error_dump->trans_ptr->len,
-                                    fw_error_dump->op_mode_len);
+               if (fw_error_dump->trans_ptr)
+                       sg_pcopy_from_buffer(sg_dump_data,
+                                            sg_nents(sg_dump_data),
+                                            fw_error_dump->trans_ptr->data,
+                                            fw_error_dump->trans_ptr->len,
+                                            fw_error_dump->op_mode_len);
                dev_coredumpsg(mvm->trans->dev, sg_dump_data, file_len,
                               GFP_KERNEL);
        }