Netdev List
 help / color / mirror / Atom feed
From: Santosh Shilimkar <santosh.shilimkar@oracle.com>
To: netdev@vger.kernel.org, davem@davemloft.net
Cc: santosh.shilimkar@oracle.com
Subject: [net][PATCH 5/5] rds: avoid version downgrade to legitimate newer peer connections
Date: Tue,  9 Jul 2019 22:32:44 -0700	[thread overview]
Message-ID: <1562736764-31752-6-git-send-email-santosh.shilimkar@oracle.com> (raw)
In-Reply-To: <1562736764-31752-1-git-send-email-santosh.shilimkar@oracle.com>

Connections with legitimate tos values can get into usual connection
race. It can result in consumer reject. We don't want tos value or
protocol version to be demoted for such connections otherwise
piers would end up different tos values which can results in
no connection. Example a peer initiated connection with say
tos 8 while usual connection racing can get downgraded to tos 0
which is not desirable.

Patch fixes above issue introduced by commit
commit d021fabf525f ("rds: rdma: add consumer reject")

Reported-by: Yanjun Zhu <yanjun.zhu@oracle.com>
Tested-by: Yanjun Zhu <yanjun.zhu@oracle.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
---
 net/rds/rdma_transport.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/rds/rdma_transport.c b/net/rds/rdma_transport.c
index 9db455d..ff74c4b 100644
--- a/net/rds/rdma_transport.c
+++ b/net/rds/rdma_transport.c
@@ -117,8 +117,10 @@ static int rds_rdma_cm_event_handler_cmn(struct rdma_cm_id *cm_id,
 		     ((*err) <= RDS_RDMA_REJ_INCOMPAT))) {
 			pr_warn("RDS/RDMA: conn <%pI6c, %pI6c> rejected, dropping connection\n",
 				&conn->c_laddr, &conn->c_faddr);
-			conn->c_proposed_version = RDS_PROTOCOL_COMPAT_VERSION;
-			conn->c_tos = 0;
+
+			if (!conn->c_tos)
+				conn->c_proposed_version = RDS_PROTOCOL_COMPAT_VERSION;
+
 			rds_conn_drop(conn);
 		}
 		rdsdebug("Connection rejected: %s\n",
-- 
1.9.1


  parent reply	other threads:[~2019-07-10  5:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-10  5:32 [net][PATCH 0/5] rds fixes Santosh Shilimkar
2019-07-10  5:32 ` [net][PATCH 1/5] rds: fix reordering with composite message notification Santosh Shilimkar
2019-07-10 14:23   ` Yanjun Zhu
2019-07-10  5:32 ` [net][PATCH 2/5] Revert "RDS: IB: split the mr registration and invalidation path" Santosh Shilimkar
2019-07-10  5:32 ` [net][PATCH 3/5] rds: Accept peer connection reject messages due to incompatible version Santosh Shilimkar
2019-07-10 14:24   ` Yanjun Zhu
2019-07-10  5:32 ` [net][PATCH 4/5] rds: Return proper "tos" value to user-space Santosh Shilimkar
2019-07-10 14:25   ` Yanjun Zhu
2019-07-10  5:32 ` Santosh Shilimkar [this message]
2019-07-10 14:26   ` [net][PATCH 5/5] rds: avoid version downgrade to legitimate newer peer connections Yanjun Zhu
2019-07-11 22:27 ` [net][PATCH 0/5] rds fixes David Miller

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=1562736764-31752-6-git-send-email-santosh.shilimkar@oracle.com \
    --to=santosh.shilimkar@oracle.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.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