Message ID | 20100422095327.GP29647@bicker |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
Dan Carpenter wrote: > 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 <error27@gmail.com> > --- > Found by a static checker, and compile tested only. :/ Looks fine to me. Acked-by: Patrick McHardy <kaber@trash.net> -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Dan Carpenter <error27@gmail.com> Date: Thu, 22 Apr 2010 11:53:27 +0200 > 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 <error27@gmail.com> Applied. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 4568120..fe776c9 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)
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 <error27@gmail.com> --- Found by a static checker, and compile tested only. :/ -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html