2018-07-25 10:02:20

by Yue Haibing

[permalink] [raw]
Subject: [PATCH net-next] tipc: add missing dev_put() on error in tipc_enable_l2_media

when tipc_own_id failed to obtain node identity,dev_put should
be call before return -EINVAL.

Fixes: 682cd3cf946b ("tipc: confgiure and apply UDP bearer MTU on running links")
Signed-off-by: YueHaibing <[email protected]>
---
net/tipc/bearer.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index fd6d8f1..418f03d 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -395,6 +395,7 @@ int tipc_enable_l2_media(struct net *net, struct tipc_bearer *b,
tipc_net_init(net, node_id, 0);
}
if (!tipc_own_id(net)) {
+ dev_put(dev);
pr_warn("Failed to obtain node identity\n");
return -EINVAL;
}
--
2.7.0




2018-07-26 02:19:38

by Jon Maloy

[permalink] [raw]
Subject: RE: [PATCH net-next] tipc: add missing dev_put() on error in tipc_enable_l2_media

Acked
///Jon Maloy

> -----Original Message-----
> From: [email protected] <[email protected]> On Behalf Of YueHaibing
> Sent: Wednesday, 25 July, 2018 05:01
> To: [email protected]; Jon Maloy <[email protected]>; [email protected]
> Cc: [email protected]; [email protected]; [email protected]; YueHaibing
> <[email protected]>
> Subject: [PATCH net-next] tipc: add missing dev_put() on error in tipc_enable_l2_media
>
> when tipc_own_id failed to obtain node identity,dev_put should
> be call before return -EINVAL.
>
> Fixes: 682cd3cf946b ("tipc: confgiure and apply UDP bearer MTU on running links")
> Signed-off-by: YueHaibing <[email protected]>
> ---
> net/tipc/bearer.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
> index fd6d8f1..418f03d 100644
> --- a/net/tipc/bearer.c
> +++ b/net/tipc/bearer.c
> @@ -395,6 +395,7 @@ int tipc_enable_l2_media(struct net *net, struct tipc_bearer *b,
> tipc_net_init(net, node_id, 0);
> }
> if (!tipc_own_id(net)) {
> + dev_put(dev);
> pr_warn("Failed to obtain node identity\n");
> return -EINVAL;
> }
> --
> 2.7.0
>


2018-07-26 21:07:43

by David Miller

[permalink] [raw]
Subject: Re: [PATCH net-next] tipc: add missing dev_put() on error in tipc_enable_l2_media

From: YueHaibing <[email protected]>
Date: Wed, 25 Jul 2018 18:00:49 +0800

> when tipc_own_id failed to obtain node identity,dev_put should
> be call before return -EINVAL.
>
> Fixes: 682cd3cf946b ("tipc: confgiure and apply UDP bearer MTU on running links")
> Signed-off-by: YueHaibing <[email protected]>

Applied to net-next, thank you.