mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00:00
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);
|
client->tls);
|
||||||
|
|
||||||
/* Begin the TLS handshake. */
|
/* Begin the TLS handshake. */
|
||||||
|
virObjectLock(client->tlsCtxt);
|
||||||
ret = virNetTLSSessionHandshake(client->tls);
|
ret = virNetTLSSessionHandshake(client->tls);
|
||||||
|
virObjectUnlock(client->tlsCtxt);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
/* Unlikely, but ... Next step is to check the certificate. */
|
/* Unlikely, but ... Next step is to check the certificate. */
|
||||||
if (virNetServerClientCheckAccess(client) < 0)
|
if (virNetServerClientCheckAccess(client) < 0)
|
||||||
@ -1435,7 +1437,9 @@ virNetServerClientDispatchHandshake(virNetServerClientPtr client)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
/* Continue the handshake. */
|
/* Continue the handshake. */
|
||||||
|
virObjectLock(client->tlsCtxt);
|
||||||
ret = virNetTLSSessionHandshake(client->tls);
|
ret = virNetTLSSessionHandshake(client->tls);
|
||||||
|
virObjectUnlock(client->tlsCtxt);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
/* Finished. Next step is to check the certificate. */
|
/* Finished. Next step is to check the certificate. */
|
||||||
if (virNetServerClientCheckAccess(client) < 0)
|
if (virNetServerClientCheckAccess(client) < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user