]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bnx2x: fix memory leak in bnx2x_init_firmware()
authorMichal Schmidt <mschmidt@redhat.com>
Thu, 15 Mar 2012 14:08:29 +0000 (14:08 +0000)
committerJoe Jin <joe.jin@oracle.com>
Wed, 16 May 2012 14:52:35 +0000 (22:52 +0800)
commit4a076d7a5f3791e39592c92a044f06420f1a3ec3
treee110a404e233fc03e38a3c47ead6e215909074b8
parente4c344456dc71f27735c2cb3ae3137bef5099c72
bnx2x: fix memory leak in bnx2x_init_firmware()

When cycling the interface down and up, bnx2x_init_firmware() knows that
the firmware is already loaded, but nevertheless it allocates certain
arrays anew (init_data, init_ops, init_ops_offsets, iro_arr). The old
arrays are leaked.

Fix the leaks by returning early if the firmware was already loaded.
Because if the firmware is loaded, so are the arrays.

(cherry picked from commit c0ea452e422a1fc78ec8c639df64012d0b8dbb4a)
Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Acked-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
drivers/net/bnx2x/bnx2x_main.c