netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] IPv6: datagram_send_ctl() should exit immediately when an error occured
@ 2008-07-30  1:30 Miao Xie
  2008-07-30  6:58 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Miao Xie @ 2008-07-30  1:30 UTC (permalink / raw)
  To: NETWORKING [IPv4/IPv6]; +Cc: David S. Miller, Pekka Savola, Hideaki YOSHIFUJI

When an error occured, datagram_send_ctl() should exit immediately rather than
continue to run the for loop. Otherwise, the variable err might be changed and
the error might be hidden.

Fix this bug by using "goto" instead of "break".

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>

---
 net/ipv6/datagram.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index f7b535d..410046a 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -732,7 +732,7 @@ int datagram_send_ctl(struct net *net,
 			LIMIT_NETDEBUG(KERN_DEBUG "invalid cmsg type: %d\n",
 				       cmsg->cmsg_type);
 			err = -EINVAL;
-			break;
+			goto exit_f;
 		}
 	}
 
-- 
1.5.4.rc3



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

* Re: [PATCH] IPv6: datagram_send_ctl() should exit immediately when an error occured
  2008-07-30  1:30 [PATCH] IPv6: datagram_send_ctl() should exit immediately when an error occured Miao Xie
@ 2008-07-30  6:58 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-07-30  6:58 UTC (permalink / raw)
  To: miaox; +Cc: netdev, pekkas, yoshfuji

From: Miao Xie <miaox@cn.fujitsu.com>
Date: Wed, 30 Jul 2008 09:30:43 +0800

> When an error occured, datagram_send_ctl() should exit immediately rather than
> continue to run the for loop. Otherwise, the variable err might be changed and
> the error might be hidden.
> 
> Fix this bug by using "goto" instead of "break".
> 
> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>

Applied, thanks.

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

end of thread, other threads:[~2008-07-30  6:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-30  1:30 [PATCH] IPv6: datagram_send_ctl() should exit immediately when an error occured Miao Xie
2008-07-30  6:58 ` 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).