[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56702E7E.5000604@cumulusnetworks.com>
Date: Tue, 15 Dec 2015 08:15:10 -0700
From: David Ahern <dsa@...ulusnetworks.com>
To: Ben Hutchings <ben@...adent.org.uk>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Nikolay Aleksandrov <nikolay@...ulusnetworks.com>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH 4.3] vrf: Fix memory leak on registration failure in
vrf_newlink()
On 12/15/15 8:12 AM, Ben Hutchings wrote:
> @@ -598,7 +599,10 @@ static int vrf_newlink(struct net *src_net, struct net_device *dev,
>
> rcu_assign_pointer(dev->vrf_ptr, vrf_ptr);
>
> - return register_netdev(dev);
> + err = register_netdev(dev);
> + if (err)
> + kfree(vrf_ptr);
> + return err;
> }
>
> static size_t vrf_nl_getsize(const struct net_device *dev)
>
The rcu_assign_pointer should only be done if the register_netdev succeeded.
Thanks for creating the patch.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists