netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@openvz.org>
To: netdev@vger.kernel.org
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	David Ahern <dsa@cumulusnetworks.com>,
	Andrey Vagin <avagin@openvz.org>,
	Stephen Hemminger <stephen@networkplumber.org>,
	Cyrill Gorcunov <gorcunov@openvz.org>
Subject: [patch net-next 2/2] [PATCH] net: ip, raw_diag -- Use jump for exiting from nested loop
Date: Wed, 02 Nov 2016 15:36:32 +0300	[thread overview]
Message-ID: <20161102125454.754267793@openvz.org> (raw)

[-- Attachment #1: inet-diag-raw-break-loop --]
[-- Type: text/plain, Size: 906 bytes --]

I managed to miss that sk_for_each is called under "for"
cycle so need to use goto here to return matching socket.

CC: David S. Miller <davem@davemloft.net>
CC: Eric Dumazet <eric.dumazet@gmail.com>
CC: David Ahern <dsa@cumulusnetworks.com>
CC: Andrey Vagin <avagin@openvz.org>
CC: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 net/ipv4/raw_diag.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-ml.git/net/ipv4/raw_diag.c
===================================================================
--- linux-ml.git.orig/net/ipv4/raw_diag.c
+++ linux-ml.git/net/ipv4/raw_diag.c
@@ -79,10 +79,11 @@ static struct sock *raw_sock_get(struct
 				 * hashinfo->lock here.
 				 */
 				sock_hold(sk);
-				break;
+				goto out_unlock;
 			}
 		}
 	}
+out_unlock:
 	read_unlock(&hashinfo->lock);
 
 	return sk ? sk : ERR_PTR(-ENOENT);

             reply	other threads:[~2016-11-02 12:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-02 12:36 Cyrill Gorcunov [this message]
2016-11-02 14:56 ` [patch net-next 2/2] [PATCH] net: ip, raw_diag -- Use jump for exiting from nested loop David Ahern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161102125454.754267793@openvz.org \
    --to=gorcunov@openvz.org \
    --cc=avagin@openvz.org \
    --cc=davem@davemloft.net \
    --cc=dsa@cumulusnetworks.com \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).