[-,OpenSFS,lustre,bug] LNET: socklnd: fix infinite loop in ksocknal_push()
diff mbox series

Message ID 87tvfx6lom.fsf@notabene.neil.brown.name
State New
Headers show
Series
  • [-,OpenSFS,lustre,bug] LNET: socklnd: fix infinite loop in ksocknal_push()
Related show

Commit Message

NeilBrown March 21, 2019, 1:49 a.m. UTC
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(-)

Comments

Degremont, Aurelien March 21, 2019, 8:25 a.m. UTC | #1
Hi
 
    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 think that would be beneficial

    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.
    
Gerrit does not handle account management itself. review.whamcloud.com relies on an external OpenID provider.
You can use any OpenID provider if you already have one. If you don't, I personally use Launchpad. You can create an account there and use it to register/login on Gerrit.  (Select 'Sign in with a Launchpad ID')

https://wiki.whamcloud.com/display/PUB/Using+Gerrit

I think that after creating your account, you must send an email request for push permission to info@whamcloud.com

Aurélien

Patch
diff mbox series

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;