-
Notifications
You must be signed in to change notification settings - Fork 155
Closed
Labels
is:bugBug description.Bug description.status:completedFrom the developer perspective, the issue was solved (bug fixed, question answered,...)From the developer perspective, the issue was solved (bug fixed, question answered,...)
Description
Hi, developers, thank you for your checking. The lockserver_opts.authkey_lock may not be correctly released if the !server_opts.authkeys satifies. Finally, the method returns with the unreleased lock server_opts.authkey_lock. The fix is to insert pthread_mutex_unlock(&server_opts.authkey_lock); before returning.
libnetconf2/src/session_server_ssh.c
Line 573 in 697729e
| pthread_mutex_lock(&server_opts.authkey_lock); |
libnetconf2/src/session_server_ssh.c
Line 577 in 697729e
| if (!server_opts.authkeys) { |
libnetconf2/src/session_server_ssh.c
Line 579 in 697729e
| return -1; |
static int
_nc_server_ssh_add_authkey(const char *pubkey_path, const char *pubkey_base64, NC_SSH_KEY_TYPE type, const char *username)
{
/* LOCK */
pthread_mutex_lock(&server_opts.authkey_lock); the lock
++server_opts.authkey_count;
server_opts.authkeys = nc_realloc(server_opts.authkeys, server_opts.authkey_count * sizeof *server_opts.authkeys);
if (!server_opts.authkeys) {
ERRMEM;
return -1; //return without releasing lock
}
...;
/* UNLOCK */
pthread_mutex_unlock(&server_opts.authkey_lock);
return 0;
}
Best,
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
is:bugBug description.Bug description.status:completedFrom the developer perspective, the issue was solved (bug fixed, question answered,...)From the developer perspective, the issue was solved (bug fixed, question answered,...)