diff options
author | Jiri Slaby <jslaby@suse.cz> | 2010-01-06 01:54:16 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-01-07 04:07:30 -0500 |
commit | 2467ab9590092ffdf837e9283e84dedd04c93ab3 (patch) | |
tree | aa528b1edbc10c3c438996aea7901ed199a58888 /drivers | |
parent | c91aa55e7e65be11d68dffb66be5f7a44506fb54 (diff) |
NET: atlx, fix memory leak
Stanse found a memory leak in atl2_get_eeprom. eeprom_buff is not
freed/assigned on all paths. Fix that.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Jay Cliburn <jcliburn@gmail.com>
Cc: Chris Snook <chris.snook@gmail.com>
Cc: Jie Yang <jie.yang@atheros.com>
Cc: atl1-devel@lists.sourceforge.net
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/atlx/atl2.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c index c0451d75cdcf..ec52529394ad 100644 --- a/drivers/net/atlx/atl2.c +++ b/drivers/net/atlx/atl2.c | |||
@@ -1959,12 +1959,15 @@ static int atl2_get_eeprom(struct net_device *netdev, | |||
1959 | return -ENOMEM; | 1959 | return -ENOMEM; |
1960 | 1960 | ||
1961 | for (i = first_dword; i < last_dword; i++) { | 1961 | for (i = first_dword; i < last_dword; i++) { |
1962 | if (!atl2_read_eeprom(hw, i*4, &(eeprom_buff[i-first_dword]))) | 1962 | if (!atl2_read_eeprom(hw, i*4, &(eeprom_buff[i-first_dword]))) { |
1963 | return -EIO; | 1963 | ret_val = -EIO; |
1964 | goto free; | ||
1965 | } | ||
1964 | } | 1966 | } |
1965 | 1967 | ||
1966 | memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 3), | 1968 | memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 3), |
1967 | eeprom->len); | 1969 | eeprom->len); |
1970 | free: | ||
1968 | kfree(eeprom_buff); | 1971 | kfree(eeprom_buff); |
1969 | 1972 | ||
1970 | return ret_val; | 1973 | return ret_val; |