netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] netlabel: netlink_unicast calls kfree_skb on error path by itself
@ 2008-07-10 13:11 Denis V. Lunev
  2008-07-10 13:42 ` Paul Moore
  0 siblings, 1 reply; 3+ messages in thread
From: Denis V. Lunev @ 2008-07-10 13:11 UTC (permalink / raw)
  To: davem; +Cc: netdev, paul.moore, Denis V. Lunev

So, no need to kfree_skb here on the error path. In this case we can simply
return.

Signed-off-by: Denis V. Lunev <den@openvz.org>
---
 net/netlabel/netlabel_cipso_v4.c  |    7 +------
 net/netlabel/netlabel_mgmt.c      |   12 ++----------
 net/netlabel/netlabel_unlabeled.c |    6 +-----
 3 files changed, 4 insertions(+), 21 deletions(-)

diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c
index fdc14a0..9080c61 100644
--- a/net/netlabel/netlabel_cipso_v4.c
+++ b/net/netlabel/netlabel_cipso_v4.c
@@ -584,12 +584,7 @@ list_start:
 	rcu_read_unlock();
 
 	genlmsg_end(ans_skb, data);
-
-	ret_val = genlmsg_reply(ans_skb, info);
-	if (ret_val != 0)
-		goto list_failure;
-
-	return 0;
+	return genlmsg_reply(ans_skb, info);
 
 list_retry:
 	/* XXX - this limit is a guesstimate */
diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c
index 22c1912..44be5d5 100644
--- a/net/netlabel/netlabel_mgmt.c
+++ b/net/netlabel/netlabel_mgmt.c
@@ -386,11 +386,7 @@ static int netlbl_mgmt_listdef(struct sk_buff *skb, struct genl_info *info)
 	rcu_read_unlock();
 
 	genlmsg_end(ans_skb, data);
-
-	ret_val = genlmsg_reply(ans_skb, info);
-	if (ret_val != 0)
-		goto listdef_failure;
-	return 0;
+	return genlmsg_reply(ans_skb, info);
 
 listdef_failure_lock:
 	rcu_read_unlock();
@@ -501,11 +497,7 @@ static int netlbl_mgmt_version(struct sk_buff *skb, struct genl_info *info)
 		goto version_failure;
 
 	genlmsg_end(ans_skb, data);
-
-	ret_val = genlmsg_reply(ans_skb, info);
-	if (ret_val != 0)
-		goto version_failure;
-	return 0;
+	return genlmsg_reply(ans_skb, info);
 
 version_failure:
 	kfree_skb(ans_skb);
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
index 52b2611..56f8087 100644
--- a/net/netlabel/netlabel_unlabeled.c
+++ b/net/netlabel/netlabel_unlabeled.c
@@ -1107,11 +1107,7 @@ static int netlbl_unlabel_list(struct sk_buff *skb, struct genl_info *info)
 		goto list_failure;
 
 	genlmsg_end(ans_skb, data);
-
-	ret_val = genlmsg_reply(ans_skb, info);
-	if (ret_val != 0)
-		goto list_failure;
-	return 0;
+	return genlmsg_reply(ans_skb, info);
 
 list_failure:
 	kfree_skb(ans_skb);
-- 
1.5.3.rc5


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

* Re: [PATCH 1/1] netlabel: netlink_unicast calls kfree_skb on error path by itself
  2008-07-10 13:11 [PATCH 1/1] netlabel: netlink_unicast calls kfree_skb on error path by itself Denis V. Lunev
@ 2008-07-10 13:42 ` Paul Moore
  2008-07-10 23:53   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Moore @ 2008-07-10 13:42 UTC (permalink / raw)
  To: Denis V. Lunev; +Cc: davem, netdev

On Thursday 10 July 2008 9:11:24 am Denis V. Lunev wrote:
> So, no need to kfree_skb here on the error path. In this case we can
> simply return.
>
> Signed-off-by: Denis V. Lunev <den@openvz.org>

Hi Denis,

Thanks for catching this and fixing it.

Acked-by: Paul Moore <paul.moore@hp.com>

> ---
>  net/netlabel/netlabel_cipso_v4.c  |    7 +------
>  net/netlabel/netlabel_mgmt.c      |   12 ++----------
>  net/netlabel/netlabel_unlabeled.c |    6 +-----
>  3 files changed, 4 insertions(+), 21 deletions(-)
>
> diff --git a/net/netlabel/netlabel_cipso_v4.c
> b/net/netlabel/netlabel_cipso_v4.c index fdc14a0..9080c61 100644
> --- a/net/netlabel/netlabel_cipso_v4.c
> +++ b/net/netlabel/netlabel_cipso_v4.c
> @@ -584,12 +584,7 @@ list_start:
>  	rcu_read_unlock();
>
>  	genlmsg_end(ans_skb, data);
> -
> -	ret_val = genlmsg_reply(ans_skb, info);
> -	if (ret_val != 0)
> -		goto list_failure;
> -
> -	return 0;
> +	return genlmsg_reply(ans_skb, info);
>
>  list_retry:
>  	/* XXX - this limit is a guesstimate */
> diff --git a/net/netlabel/netlabel_mgmt.c
> b/net/netlabel/netlabel_mgmt.c index 22c1912..44be5d5 100644
> --- a/net/netlabel/netlabel_mgmt.c
> +++ b/net/netlabel/netlabel_mgmt.c
> @@ -386,11 +386,7 @@ static int netlbl_mgmt_listdef(struct sk_buff
> *skb, struct genl_info *info) rcu_read_unlock();
>
>  	genlmsg_end(ans_skb, data);
> -
> -	ret_val = genlmsg_reply(ans_skb, info);
> -	if (ret_val != 0)
> -		goto listdef_failure;
> -	return 0;
> +	return genlmsg_reply(ans_skb, info);
>
>  listdef_failure_lock:
>  	rcu_read_unlock();
> @@ -501,11 +497,7 @@ static int netlbl_mgmt_version(struct sk_buff
> *skb, struct genl_info *info) goto version_failure;
>
>  	genlmsg_end(ans_skb, data);
> -
> -	ret_val = genlmsg_reply(ans_skb, info);
> -	if (ret_val != 0)
> -		goto version_failure;
> -	return 0;
> +	return genlmsg_reply(ans_skb, info);
>
>  version_failure:
>  	kfree_skb(ans_skb);
> diff --git a/net/netlabel/netlabel_unlabeled.c
> b/net/netlabel/netlabel_unlabeled.c index 52b2611..56f8087 100644
> --- a/net/netlabel/netlabel_unlabeled.c
> +++ b/net/netlabel/netlabel_unlabeled.c
> @@ -1107,11 +1107,7 @@ static int netlbl_unlabel_list(struct sk_buff
> *skb, struct genl_info *info) goto list_failure;
>
>  	genlmsg_end(ans_skb, data);
> -
> -	ret_val = genlmsg_reply(ans_skb, info);
> -	if (ret_val != 0)
> -		goto list_failure;
> -	return 0;
> +	return genlmsg_reply(ans_skb, info);
>
>  list_failure:
>  	kfree_skb(ans_skb);



-- 
paul moore
linux @ hp

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

* Re: [PATCH 1/1] netlabel: netlink_unicast calls kfree_skb on error path by itself
  2008-07-10 13:42 ` Paul Moore
@ 2008-07-10 23:53   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2008-07-10 23:53 UTC (permalink / raw)
  To: paul.moore; +Cc: den, netdev

From: Paul Moore <paul.moore@hp.com>
Date: Thu, 10 Jul 2008 09:42:49 -0400

> On Thursday 10 July 2008 9:11:24 am Denis V. Lunev wrote:
> > So, no need to kfree_skb here on the error path. In this case we can
> > simply return.
> >
> > Signed-off-by: Denis V. Lunev <den@openvz.org>
> 
> Hi Denis,
> 
> Thanks for catching this and fixing it.
> 
> Acked-by: Paul Moore <paul.moore@hp.com>

Applied, thanks guys!

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

end of thread, other threads:[~2008-07-10 23:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-10 13:11 [PATCH 1/1] netlabel: netlink_unicast calls kfree_skb on error path by itself Denis V. Lunev
2008-07-10 13:42 ` Paul Moore
2008-07-10 23:53   ` 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).