]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bnx2x: fix a crash on corrupt firmware file
authorMichal Schmidt <mschmidt@redhat.com>
Thu, 15 Mar 2012 14:08:28 +0000 (14:08 +0000)
committerJoe Jin <joe.jin@oracle.com>
Wed, 16 May 2012 14:51:40 +0000 (22:51 +0800)
If the requested firmware is deemed corrupt and then released, reset the
pointer to NULL in order to avoid double-freeing it in
bnx2x_release_firmware() or dereferencing it in bnx2x_init_firmware().

(cherry picked from commit 127d0a198a310970b31866af8bbb6d4b1068e546)
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

index 3b0ef152da6ec29651795c10374b8ea3f5ae3e26..b954d866ef891d0d53402f5a9f339991d2060c07 100644 (file)
@@ -10918,6 +10918,7 @@ init_ops_alloc_err:
        kfree(bp->init_data);
 request_firmware_exit:
        release_firmware(bp->firmware);
+       bp->firmware = NULL;
 
        return rc;
 }