mirror of https://gitee.com/openkylin/libvirt.git
tls: Add a mutex lock on 'tlsCtxt'
Prevent the handshake function from reading 'tlsCtxt' while updating 'tlsCtxt'. Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Zhang Bo <oscar.zhangbo@huawei.com> Signed-off-by: Wu Qingliang <wuqingliang4@huawei.com>
This commit is contained in:
parent
15d280fa97
commit
b461178639
|
@ -1114,7 +1114,9 @@ int virNetServerClientInit(virNetServerClientPtr client)
|
|||
client->tls);
|
||||
|
||||
/* Begin the TLS handshake. */
|
||||
virObjectLock(client->tlsCtxt);
|
||||
ret = virNetTLSSessionHandshake(client->tls);
|
||||
virObjectUnlock(client->tlsCtxt);
|
||||
if (ret == 0) {
|
||||
/* Unlikely, but ... Next step is to check the certificate. */
|
||||
if (virNetServerClientCheckAccess(client) < 0)
|
||||
|
@ -1435,7 +1437,9 @@ virNetServerClientDispatchHandshake(virNetServerClientPtr client)
|
|||
{
|
||||
int ret;
|
||||
/* Continue the handshake. */
|
||||
virObjectLock(client->tlsCtxt);
|
||||
ret = virNetTLSSessionHandshake(client->tls);
|
||||
virObjectUnlock(client->tlsCtxt);
|
||||
if (ret == 0) {
|
||||
/* Finished. Next step is to check the certificate. */
|
||||
if (virNetServerClientCheckAccess(client) < 0)
|
||||
|
|
Loading…
Reference in New Issue