netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/hsr: Fix possible leak in 'hsr_get_node_status()'
@ 2013-11-14 19:12 Geyslan G. Bem
  2013-11-14 20:29 ` Geyslan Gregório Bem
  2013-11-14 22:26 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Geyslan G. Bem @ 2013-11-14 19:12 UTC (permalink / raw)
  To: geyslan
  Cc: David S. Miller, Arvid Brodin, open list:NETWORKING [GENERAL],
	open list

If 'hsr_get_node_data()' returns error, going directly to 'fail' label
doesn't free the memory pointed by 'skb_out'.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
---
 net/hsr/hsr_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/hsr/hsr_netlink.c b/net/hsr/hsr_netlink.c
index 4e66bf6..aef8429 100644
--- a/net/hsr/hsr_netlink.c
+++ b/net/hsr/hsr_netlink.c
@@ -249,7 +249,7 @@ static int hsr_get_node_status(struct sk_buff *skb_in, struct genl_info *info)
 			&hsr_node_if2_age,
 			&hsr_node_if2_seq);
 	if (res < 0)
-		goto fail;
+		goto nla_put_failure;
 
 	res = nla_put(skb_out, HSR_A_NODE_ADDR, ETH_ALEN,
 					nla_data(info->attrs[HSR_A_NODE_ADDR]));
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net/hsr: Fix possible leak in 'hsr_get_node_status()'
  2013-11-14 19:12 [PATCH] net/hsr: Fix possible leak in 'hsr_get_node_status()' Geyslan G. Bem
@ 2013-11-14 20:29 ` Geyslan Gregório Bem
  2013-11-14 22:26 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Geyslan Gregório Bem @ 2013-11-14 20:29 UTC (permalink / raw)
  To: Geyslan Gregório Bem
  Cc: David S. Miller, Arvid Brodin, open list:NETWORKING [GENERAL],
	open list

2013/11/14 Geyslan G. Bem <geyslan@gmail.com>:
> If 'hsr_get_node_data()' returns error, going directly to 'fail' label
> doesn't free the memory pointed by 'skb_out'.
>
> Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
> ---
>  net/hsr/hsr_netlink.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/hsr/hsr_netlink.c b/net/hsr/hsr_netlink.c
> index 4e66bf6..aef8429 100644
> --- a/net/hsr/hsr_netlink.c
> +++ b/net/hsr/hsr_netlink.c
> @@ -249,7 +249,7 @@ static int hsr_get_node_status(struct sk_buff *skb_in, struct genl_info *info)
>                         &hsr_node_if2_age,
>                         &hsr_node_if2_seq);
>         if (res < 0)
> -               goto fail;
> +               goto nla_put_failure;
>
>         res = nla_put(skb_out, HSR_A_NODE_ADDR, ETH_ALEN,
>                                         nla_data(info->attrs[HSR_A_NODE_ADDR]));
> --
> 1.8.4.2
>

It's a Coverity catch: CID 1128855.

-- 
Regards,

Geyslan G. Bem
hackingbits.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net/hsr: Fix possible leak in 'hsr_get_node_status()'
  2013-11-14 19:12 [PATCH] net/hsr: Fix possible leak in 'hsr_get_node_status()' Geyslan G. Bem
  2013-11-14 20:29 ` Geyslan Gregório Bem
@ 2013-11-14 22:26 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2013-11-14 22:26 UTC (permalink / raw)
  To: geyslan; +Cc: arvid.brodin, netdev, linux-kernel

From: "Geyslan G. Bem" <geyslan@gmail.com>
Date: Thu, 14 Nov 2013 16:12:54 -0300

> If 'hsr_get_node_data()' returns error, going directly to 'fail' label
> doesn't free the memory pointed by 'skb_out'.
> 
> Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>

Looks good, applied, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-14 22:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-14 19:12 [PATCH] net/hsr: Fix possible leak in 'hsr_get_node_status()' Geyslan G. Bem
2013-11-14 20:29 ` Geyslan Gregório Bem
2013-11-14 22:26 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).