diff mbox

[librdmacm] rsocket: Segmentation fault fix in case of multiple connections

Message ID 1406551689-8142-1-git-send-email-ilyan@dev.mellanox.co.il (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Ilya Nelkenbaum July 28, 2014, 12:48 p.m. UTC
From: Ilya Nelkenbaum <ilyan@mellanox.com>

In case of more than 16 rsocket connections
are established, "svc->rss" buffer is reallocated
with more memory. Index 0 is reserved for the service's
communication socket, and this is not taken in count
when data is copied from old buffer location to
new one.

Signed-off-by: Ilya Nelkenbaum <ilyan@mellanox.com>
---
 src/rsocket.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Hefty, Sean July 28, 2014, 4:37 p.m. UTC | #1
thanks - applied

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/rsocket.c b/src/rsocket.c
index c7a0cb2..7007897 100644
--- a/src/rsocket.c
+++ b/src/rsocket.c
@@ -3915,8 +3915,8 @@  static int rs_svc_grow_sets(struct rs_svc *svc, int grow_size)
 	rss = set;
 	contexts = set + sizeof(*rss) * svc->size;
 	if (svc->cnt) {
-		memcpy(rss, svc->rss, sizeof(*rss) * svc->cnt);
-		memcpy(contexts, svc->contexts, svc->context_size * svc->cnt);
+		memcpy(rss, svc->rss, sizeof(*rss) * (svc->cnt + 1));
+		memcpy(contexts, svc->contexts, svc->context_size * (svc->cnt + 1));
 	}
 
 	free(svc->rss);