mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
Fix release of virNetMessagePtr instances in streams processing
If a message packet for a invalid stream is received it is just free'd. This is not good because it doesn't let the client RPC request counter decrement. If a stream is shutdown with pending packets the message also isn't released properly because of an incorrect header type * daemon/stream.c: Fix message header type * src/rpc/virnetserverprogram.c: Send dummy reply instead of free'ing ignored stream message
This commit is contained in:
parent
f1c2c0e2dc
commit
c69ba67032
@ -327,6 +327,7 @@ int daemonFreeClientStream(virNetServerClientPtr client,
|
||||
virNetMessagePtr tmp = msg->next;
|
||||
/* Send a dummy reply to free up 'msg' & unblock client rx */
|
||||
memset(msg, 0, sizeof(*msg));
|
||||
msg->header.type = VIR_NET_REPLY;
|
||||
if (virNetServerClientSendMessage(client, msg) < 0) {
|
||||
virNetServerClientMarkClose(client);
|
||||
virNetMessageFree(msg);
|
||||
|
@ -259,7 +259,13 @@ int virNetServerProgramDispatch(virNetServerProgramPtr prog,
|
||||
*/
|
||||
VIR_INFO("Ignoring unexpected stream data serial=%d proc=%d status=%d",
|
||||
msg->header.serial, msg->header.proc, msg->header.status);
|
||||
virNetMessageFree(msg);
|
||||
/* Send a dummy reply to free up 'msg' & unblock client rx */
|
||||
memset(msg, 0, sizeof(*msg));
|
||||
msg->header.type = VIR_NET_REPLY;
|
||||
if (virNetServerClientSendMessage(client, msg) < 0) {
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
@ -275,6 +281,7 @@ int virNetServerProgramDispatch(virNetServerProgramPtr prog,
|
||||
error:
|
||||
ret = virNetServerProgramSendReplyError(prog, client, msg, &rerr, &msg->header);
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user