From: Dan Carpenter Date: Wed, 21 Apr 2010 23:53:27 +0000 (+0000) Subject: rtnetlink: potential ERR_PTR dereference X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=80032cffb95edff4fc216b1cb21682257be326b7;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git rtnetlink: potential ERR_PTR dereference In the original code, if rtnl_create_link() returned an ERR_PTR then that would get passed to rtnl_configure_link() which dereferences it. Signed-off-by: Dan Carpenter Acked-by: Patrick McHardy Signed-off-by: David S. Miller --- diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 4568120d8533..fe776c9ddeca 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -1270,10 +1270,11 @@ replay: err = ops->newlink(net, dev, tb, data); else err = register_netdevice(dev); - if (err < 0 && !IS_ERR(dev)) { + + if (err < 0 && !IS_ERR(dev)) free_netdev(dev); + if (err < 0) goto out; - } err = rtnl_configure_link(dev, ifm); if (err < 0)