All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: lustre-devel@lists.lustre.org
Subject: [lustre-devel] [PATCH - OpenSFS lustre bug] LNET: socklnd: fix infinite loop in ksocknal_push()
Date: Thu, 21 Mar 2019 12:49:45 +1100	[thread overview]
Message-ID: <87tvfx6lom.fsf@notabene.neil.brown.name> (raw)


If the list_for_each_entry() loop in ksocknal_push()
ever finds a match, then it will increment 'i', and the outer
loop will continue.  Presumably it will find the same match again
and increment i and continue again.

Once peer_off becomes larger than the number of matches
in a given chain, 'peer_ni' will be an invalid pointer, and
ksocknal_push_peer() will probably crash when called on it.

To abort the outer loop properly, we need to test if
"i <= peer_off", which indicates that all matching peers
have been found.

Signed-off-by: NeilBrown <neilb@suse.com>
---

This patch is against OpenSFS lustre, not my drivers/staging tree that
most of my patches are against.

This really looks like untested code, but it is not entirely possible
that I've missed something.

If you would like me to submit this through more "normal" channels, I'm
happy to learn what they are, and then do that.
I assume this would mean getting access to the lustre Gerrit instance.
I tried the "register" link, but that takes me to

https://review.whamcloud.com/login/%23%2Fc%2F33883

which isn't very helpful.

NeilBrown


 lnet/klnds/socklnd/socklnd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lnet/klnds/socklnd/socklnd.c b/lnet/klnds/socklnd/socklnd.c
index 7bd3b5288373..041380cbfb6a 100644
--- a/lnet/klnds/socklnd/socklnd.c
+++ b/lnet/klnds/socklnd/socklnd.c
@@ -1939,7 +1939,7 @@ ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id)
 			}
 			read_unlock(&ksocknal_data.ksnd_global_lock);
 
-			if (i == 0) /* no match */
+			if (i <= peer_off) /* no match */
 				break;
 
 			rc = 0;
-- 
2.14.0.rc0.dirty

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20190321/3d34778c/attachment.sig>

             reply	other threads:[~2019-03-21  1:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-21  1:49 NeilBrown [this message]
2019-03-21  8:25 ` [lustre-devel] [PATCH - OpenSFS lustre bug] LNET: socklnd: fix infinite loop in ksocknal_push() Degremont, Aurelien

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=87tvfx6lom.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=lustre-devel@lists.lustre.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.