* [patch] rtnetlink: potential ERR_PTR dereference
@ 2010-04-22 9:53 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2010-04-22 9:53 UTC (permalink / raw)
To: netdev
Cc: Eric Dumazet, Patrick McHardy, Eric W. Biederman, Mitch Williams,
David S. Miller, kernel-janitors
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. :/
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)
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [patch] rtnetlink: potential ERR_PTR dereference
@ 2010-04-22 9:53 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2010-04-22 9:53 UTC (permalink / raw)
To: netdev
Cc: Eric Dumazet, Patrick McHardy, Eric W. Biederman, Mitch Williams,
David S. Miller, kernel-janitors
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. :/
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)
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [patch] rtnetlink: potential ERR_PTR dereference
2010-04-22 9:53 ` Dan Carpenter
@ 2010-04-22 10:35 ` Patrick McHardy
-1 siblings, 0 replies; 6+ messages in thread
From: Patrick McHardy @ 2010-04-22 10:35 UTC (permalink / raw)
To: Dan Carpenter
Cc: netdev, Eric Dumazet, Eric W. Biederman, Mitch Williams,
David S. Miller, kernel-janitors
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>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] rtnetlink: potential ERR_PTR dereference
@ 2010-04-22 10:35 ` Patrick McHardy
0 siblings, 0 replies; 6+ messages in thread
From: Patrick McHardy @ 2010-04-22 10:35 UTC (permalink / raw)
To: Dan Carpenter
Cc: netdev, Eric Dumazet, Eric W. Biederman, Mitch Williams,
David S. Miller, kernel-janitors
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>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] rtnetlink: potential ERR_PTR dereference
2010-04-22 9:53 ` Dan Carpenter
@ 2010-04-22 22:57 ` David Miller
-1 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2010-04-22 22:57 UTC (permalink / raw)
To: error27
Cc: netdev, eric.dumazet, kaber, ebiederm, mitch.a.williams,
kernel-janitors
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] rtnetlink: potential ERR_PTR dereference
@ 2010-04-22 22:57 ` David Miller
0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2010-04-22 22:57 UTC (permalink / raw)
To: error27
Cc: netdev, eric.dumazet, kaber, ebiederm, mitch.a.williams,
kernel-janitors
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-04-22 22:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-22 9:53 [patch] rtnetlink: potential ERR_PTR dereference Dan Carpenter
2010-04-22 9:53 ` Dan Carpenter
2010-04-22 10:35 ` Patrick McHardy
2010-04-22 10:35 ` Patrick McHardy
2010-04-22 22:57 ` David Miller
2010-04-22 22:57 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.