提交 2467ab95 编写于 作者: J Jiri Slaby 提交者: David S. Miller

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: NJiri 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: NDavid S. Miller <davem@davemloft.net>
上级 c91aa55e
...@@ -1959,12 +1959,15 @@ static int atl2_get_eeprom(struct net_device *netdev, ...@@ -1959,12 +1959,15 @@ static int atl2_get_eeprom(struct net_device *netdev,
return -ENOMEM; return -ENOMEM;
for (i = first_dword; i < last_dword; i++) { for (i = first_dword; i < last_dword; i++) {
if (!atl2_read_eeprom(hw, i*4, &(eeprom_buff[i-first_dword]))) if (!atl2_read_eeprom(hw, i*4, &(eeprom_buff[i-first_dword]))) {
return -EIO; ret_val = -EIO;
goto free;
}
} }
memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 3), memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 3),
eeprom->len); eeprom->len);
free:
kfree(eeprom_buff); kfree(eeprom_buff);
return ret_val; return ret_val;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册