netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com>
To: rds-devel@oss.oracle.com
Cc: "David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org,
	Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com>,
	Honggang Li <honli@redhat.com>, Josh Hunt <joshhunt00@gmail.com>,
	Bang Nguyen <bang.nguyen@oracle.com>
Subject: [PATCH] rds: prevent BUG_ON triggered on congestion update to loopback
Date: Mon, 25 Nov 2013 09:47:34 +0300	[thread overview]
Message-ID: <1385167442-6997-1-git-send-email-venkat.x.venkatsubra@oracle.com> (raw)

From: Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com>

After congestion update on a local connection, when rds_ib_xmit returns
less bytes than that are there in the message, rds_send_xmit calls
back rds_ib_xmit with an offset that causes BUG_ON(off & RDS_FRAG_SIZE)
to trigger.

Reported-by: Josh Hunt <joshhunt00@gmail.com>
Tested-by: Honggang Li <honli@redhat.com>
Acked-by: Bang Nguyen <bang.nguyen@oracle.com>
Signed-off-by: Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 net/rds/ib_send.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/rds/ib_send.c b/net/rds/ib_send.c
index e590949..37be6e2 100644
--- a/net/rds/ib_send.c
+++ b/net/rds/ib_send.c
@@ -552,9 +552,8 @@ int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm,
 	    && rm->m_inc.i_hdr.h_flags & RDS_FLAG_CONG_BITMAP) {
 		rds_cong_map_updated(conn->c_fcong, ~(u64) 0);
 		scat = &rm->data.op_sg[sg];
-		ret = sizeof(struct rds_header) + RDS_CONG_MAP_BYTES;
-		ret = min_t(int, ret, scat->length - conn->c_xmit_data_off);
-		return ret;
+		ret = max_t(int, RDS_CONG_MAP_BYTES, scat->length);
+		return sizeof(struct rds_header) + ret;
 	}
 
 	/* FIXME we may overallocate here */
-- 
1.7.6

             reply	other threads:[~2013-11-25  6:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-25  6:47 Venkat Venkatsubra [this message]
2013-12-02  1:19 ` [PATCH] rds: prevent BUG_ON triggered on congestion update to loopback David Miller
  -- strict thread matches above, loose matches on Subject: below --
2013-12-02 23:41 Venkat Venkatsubra
2013-12-03 16:55 ` 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=1385167442-6997-1-git-send-email-venkat.x.venkatsubra@oracle.com \
    --to=venkat.x.venkatsubra@oracle.com \
    --cc=bang.nguyen@oracle.com \
    --cc=davem@davemloft.net \
    --cc=honli@redhat.com \
    --cc=joshhunt00@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=rds-devel@oss.oracle.com \
    /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).