Message ID | 20170130103432.24613-1-luca@coelho.fi (mailing list archive) |
---|---|
State | Accepted |
Commit | d546530e569463a7f0a4ead482d277b5ef42a3aa |
Delegated to: | Kalle Valo |
Headers | show |
Luca Coelho <luca@coelho.fi> writes: > From: Sara Sharon <sara.sharon@intel.com> > > For old firmwares the memory wasn't allocated, resulting in panic. > Make it dynamically allocated as well. Allow any order of functions > call. > > Fixes: eef187a7b8a1 ("iwlwifi: enlarge number of ucode sections") > Signed-off-by: Sara Sharon <sara.sharon@intel.com> > Signed-off-by: Luca Coelho <luciano.coelho@intel.com> > --- > > Kalle, > > Could you test this patch to see if it solves the problem? It does, thank you for quickly fixing this. Tested-by: Kalle Valo <kvalo@codeaurora.org> As this is a serious regression can I apply this directly to wireless-drivers-next?
On Mon, 2017-01-30 at 13:40 +0200, Kalle Valo wrote: > Luca Coelho <luca@coelho.fi> writes: > > > From: Sara Sharon <sara.sharon@intel.com> > > > > For old firmwares the memory wasn't allocated, resulting in panic. > > Make it dynamically allocated as well. Allow any order of functions > > call. > > > > Fixes: eef187a7b8a1 ("iwlwifi: enlarge number of ucode sections") > > Signed-off-by: Sara Sharon <sara.sharon@intel.com> > > Signed-off-by: Luca Coelho <luciano.coelho@intel.com> > > --- > > > > Kalle, > > > > Could you test this patch to see if it solves the problem? > > It does, thank you for quickly fixing this. > > Tested-by: Kalle Valo <kvalo@codeaurora.org> Great! Thanks a lot for testing it quickly. :) > As this is a serious regression can I apply this directly to > wireless-drivers-next? Yes, please go ahead. -- Cheers, Luca.
Luciano Coelho <luca@coelho.fi> wrote: > From: Sara Sharon <sara.sharon@intel.com> > > For old firmwares the memory wasn't allocated, resulting in panic. > Make it dynamically allocated as well. Allow any order of functions > call. > > Fixes: eef187a7b8a1 ("iwlwifi: enlarge number of ucode sections") > Signed-off-by: Sara Sharon <sara.sharon@intel.com> > Signed-off-by: Luca Coelho <luciano.coelho@intel.com> > Tested-by: Kalle Valo <kvalo@codeaurora.org> Patch applied to wireless-drivers-next.git, thanks. d546530e5694 iwlwifi: alloc memory dynamically also for DVM
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c index 1d1af4bc1530..d22821501676 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c @@ -291,11 +291,33 @@ static struct fw_sec *get_sec(struct iwl_firmware_pieces *pieces, return &pieces->img[type].sec[sec]; } +static void alloc_sec_data(struct iwl_firmware_pieces *pieces, + enum iwl_ucode_type type, + int sec) +{ + struct fw_img_parsing *img = &pieces->img[type]; + struct fw_sec *sec_memory; + int size = sec + 1; + size_t alloc_size = sizeof(*img->sec) * size; + + if (img->sec && img->sec_counter >= size) + return; + + sec_memory = krealloc(img->sec, alloc_size, GFP_KERNEL); + if (!sec_memory) + return; + + img->sec = sec_memory; + img->sec_counter = size; +} + static void set_sec_data(struct iwl_firmware_pieces *pieces, enum iwl_ucode_type type, int sec, const void *data) { + alloc_sec_data(pieces, type, sec); + pieces->img[type].sec[sec].data = data; } @@ -304,6 +326,8 @@ static void set_sec_size(struct iwl_firmware_pieces *pieces, int sec, size_t size) { + alloc_sec_data(pieces, type, sec); + pieces->img[type].sec[sec].size = size; } @@ -319,6 +343,8 @@ static void set_sec_offset(struct iwl_firmware_pieces *pieces, int sec, u32 offset) { + alloc_sec_data(pieces, type, sec); + pieces->img[type].sec[sec].offset = offset; }