s390/qeth: fix early exit from error path
authorJulian Wiedmann <jwi@linux.vnet.ibm.com>
Wed, 18 Oct 2017 15:40:17 +0000 (17:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 Dec 2017 14:07:55 +0000 (15:07 +0100)
[ Upstream commit 83cf79a2fec3cf499eb6cb9eb608656fc2a82776 ]

When the allocation of the addr buffer fails, we need to free
our refcount on the inetdevice before returning.

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/s390/net/qeth_l3_main.c

index ab661a431f7c6405f2e4c2b9d60c9dee287a9618..1d8c317553ba83b24b681a268767e6ad2e32fbbc 100644 (file)
@@ -1553,7 +1553,7 @@ static void qeth_l3_free_vlan_addresses4(struct qeth_card *card,
 
        addr = qeth_l3_get_addr_buffer(QETH_PROT_IPV4);
        if (!addr)
-               return;
+               goto out;
 
        spin_lock_bh(&card->ip_lock);
 
@@ -1567,6 +1567,7 @@ static void qeth_l3_free_vlan_addresses4(struct qeth_card *card,
        spin_unlock_bh(&card->ip_lock);
 
        kfree(addr);
+out:
        in_dev_put(in_dev);
 }
 
@@ -1591,7 +1592,7 @@ static void qeth_l3_free_vlan_addresses6(struct qeth_card *card,
 
        addr = qeth_l3_get_addr_buffer(QETH_PROT_IPV6);
        if (!addr)
-               return;
+               goto out;
 
        spin_lock_bh(&card->ip_lock);
 
@@ -1606,6 +1607,7 @@ static void qeth_l3_free_vlan_addresses6(struct qeth_card *card,
        spin_unlock_bh(&card->ip_lock);
 
        kfree(addr);
+out:
        in6_dev_put(in6_dev);
 #endif /* CONFIG_QETH_IPV6 */
 }