Skip to content
Snippets Groups Projects
Commit e766066e authored by maxim's avatar maxim
Browse files

b=11495

i=isaac
Fix of double-free bug in tcplnd (Checking return from read_connection())
parent 2f5681ce
No related branches found
No related tags found
No related merge requests found
...@@ -166,26 +166,30 @@ int tcpnal_recv(lnet_ni_t *ni, ...@@ -166,26 +166,30 @@ int tcpnal_recv(lnet_ni_t *ni,
/* FIXME /* FIXME
* 1. Is this effecient enough? change to use readv() directly? * 1. Is this effecient enough? change to use readv() directly?
* 2. need check return from read_connection()
* - MeiJia * - MeiJia
*/ */
for (i = 0; i < ntiov; i++) for (i = 0; i < ntiov; i++)
read_connection(private, tiov[i].iov_base, tiov[i].iov_len); if (!read_connection(private, tiov[i].iov_base, tiov[i].iov_len))
return -EIO;
finalize: finalize:
/* FIXME; we always assume success here... */
lnet_finalize(ni, cookie, 0);
LASSERT(rlen >= mlen); LASSERT(rlen >= mlen);
if (mlen != rlen){ if (mlen != rlen){
int rc;
char *trash=malloc(rlen - mlen); char *trash=malloc(rlen - mlen);
/*TODO: check error status*/ if (!trash)
read_connection(private, trash, rlen - mlen); return -ENOMEM;
rc = read_connection(private, trash, rlen - mlen);
free(trash); free(trash);
if (!rc)
return -EIO;
} }
lnet_finalize(ni, cookie, 0);
return(0); return(0);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment