]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Net, libertas: Resolve memory leak in if_spi_host_to_card()
authorJesper Juhl <jj@chaosbits.net>
Sun, 13 Nov 2011 21:14:32 +0000 (22:14 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sat, 26 Nov 2011 17:08:34 +0000 (09:08 -0800)
commit fe09b32a4361bea44169b2063e8c867cabb6a8ba upstream.

If we hit the default case in the switch in if_spi_host_to_card() we'll leak
the memory we allocated for 'packet'. This patch resolves the leak by freeing
the allocated memory in that case.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/net/wireless/libertas/if_spi.c

index e0286cfbc91d1e3a9001ccf16dd68193ed729064..7be8b051aabcf2f4e3a33365150873d390f33b5d 100644 (file)
@@ -999,6 +999,7 @@ static int if_spi_host_to_card(struct lbs_private *priv,
                spin_unlock_irqrestore(&card->buffer_lock, flags);
                break;
        default:
+               kfree(packet);
                netdev_err(priv->dev, "can't transfer buffer of type %d\n",
                           type);
                err = -EINVAL;