When sending multiple requests, rte_mp_request_sync
can succeed sending a few of those requests, but then
fail on a later one and in the end return with rc=-1.
The upper layers - e.g. device hotplug - currently
handles this case as if no messages were sent and no
memory for response buffers was allocated, which is
not true. Fixed by always freeing memory buffers on
failure.
Bugzilla ID: 228
Fixes:
783b6e54971d ("eal: add synchronous multi-process communication")
Cc: stable@dpdk.org
Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
RTE_LOG(DEBUG, EAL, "request: %s\n", req->name);
RTE_LOG(DEBUG, EAL, "request: %s\n", req->name);
- if (check_input(req) == false)
- return -1;
-
reply->nb_sent = 0;
reply->nb_received = 0;
reply->msgs = NULL;
reply->nb_sent = 0;
reply->nb_received = 0;
reply->msgs = NULL;
+ if (check_input(req) == false)
+ goto err;
+
if (internal_config.no_shconf) {
RTE_LOG(DEBUG, EAL, "No shared files mode enabled, IPC is disabled\n");
return 0;
if (internal_config.no_shconf) {
RTE_LOG(DEBUG, EAL, "No shared files mode enabled, IPC is disabled\n");
return 0;
if (gettimeofday(&now, NULL) < 0) {
RTE_LOG(ERR, EAL, "Failed to get current time\n");
rte_errno = errno;
if (gettimeofday(&now, NULL) < 0) {
RTE_LOG(ERR, EAL, "Failed to get current time\n");
rte_errno = errno;
}
end.tv_nsec = (now.tv_usec * 1000 + ts->tv_nsec) % 1000000000;
}
end.tv_nsec = (now.tv_usec * 1000 + ts->tv_nsec) % 1000000000;
pthread_mutex_lock(&pending_requests.lock);
ret = mp_request_sync(eal_mp_socket_path(), req, reply, &end);
pthread_mutex_unlock(&pending_requests.lock);
pthread_mutex_lock(&pending_requests.lock);
ret = mp_request_sync(eal_mp_socket_path(), req, reply, &end);
pthread_mutex_unlock(&pending_requests.lock);
if (!mp_dir) {
RTE_LOG(ERR, EAL, "Unable to open directory %s\n", mp_dir_path);
rte_errno = errno;
if (!mp_dir) {
RTE_LOG(ERR, EAL, "Unable to open directory %s\n", mp_dir_path);
rte_errno = errno;
}
dir_fd = dirfd(mp_dir);
}
dir_fd = dirfd(mp_dir);
mp_dir_path);
closedir(mp_dir);
rte_errno = errno;
mp_dir_path);
closedir(mp_dir);
rte_errno = errno;
}
pthread_mutex_lock(&pending_requests.lock);
}
pthread_mutex_lock(&pending_requests.lock);
* locks on receive
*/
if (mp_request_sync(path, req, reply, &end))
* locks on receive
*/
if (mp_request_sync(path, req, reply, &end))
}
pthread_mutex_unlock(&pending_requests.lock);
/* unlock the directory */
}
pthread_mutex_unlock(&pending_requests.lock);
/* unlock the directory */
/* dir_fd automatically closed on closedir */
closedir(mp_dir);
return ret;
/* dir_fd automatically closed on closedir */
closedir(mp_dir);
return ret;
+
+err:
+ free(reply->msgs);
+ reply->nb_received = 0;
+ reply->msgs = NULL;
+ return -1;