Kernel Bug Tracker – Bug 32712
Memory kcalloc'ed in ath5k_eeprom_convert_pcal_info_*() is not always kfree'd
Last modified: 2011-04-29 17:55:42 UTC
This problem concerns 'ath5k' driver.
When ath5k_hw_init() performs necessary initialization tasks, ath5k_eeprom_init() is called. One of ath5k_eeprom_convert_pcal_info_[5111|5112|2413]() functions is called then, among other things. On my system, it is ath5k_eeprom_convert_pcal_info_2413() but everything also applies to the other two functions.
ath5k_eeprom_convert_pcal_info_2413() allocates several memory blocks in 'for' loops with kcalloc (see the lines 1153, 1176, 1182). It seems unlikely that any of these allocations will fail, the sizes of the memory blocks are rather small. Nevertheless, if one of these allocations fails, the memory blocks allocated in ath5k_eeprom_convert_pcal_info_2413() before will probably never be freed.
They could be freed by ath5k_eeprom_free_pcal_info() but this function is not called in this case.
Not a critical problem, it seems, but still.
This is queued for 2.6.40...
Author: John W. Linville <email@example.com>
Date: Fri Apr 8 15:33:12 2011 -0400
ath5k: improve pcal error handling for ENOMEM case
The ath5k driver does kmalloc allocations for pcal info in a loop.
But, if one fails it was simply returning -ENOMEM without freeing
already allocated memory. This patch corrects that oversight.
Reported-by: Eugene A. Shatokhin <firstname.lastname@example.org>
Signed-off-by: John W. Linville <email@example.com>
Reviewed-by: Bob Copeland <firstname.lastname@example.org>