diff mbox series

[1/2] clnt_dg_freeres() uncleared set active state may deadlock.

Message ID 20220726141906.69023-1-attila.kovacs@cfa.harvard.edu (mailing list archive)
State New, archived
Headers show
Series [1/2] clnt_dg_freeres() uncleared set active state may deadlock. | expand

Commit Message

Attila Kovacs July 26, 2022, 2:19 p.m. UTC
From: Attila Kovacs <attipaci@gmail.com>

In clnt_dg.c in clnt_dg_freeres(), cu_fd_lock->active is set to TRUE, with no 
corresponding clearing when the operation (*xdr_res() call) is completed. This 
would leave other waiting operations blocked indefinitely, effectively 
deadlocking the client. For comparison, clnt_vd_freeres() in clnt_vc.c does not
set the active state to TRUE. I believe the vc behavior is correct, while the 
dg behavior is a bug. 

Signed-off-by: Attila Kovacs <attipaci@gmail.com>
---
 src/clnt_dg.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Steve Dickson July 28, 2022, 1:17 p.m. UTC | #1
On 7/26/22 10:19 AM, Attila Kovacs wrote:
> From: Attila Kovacs <attipaci@gmail.com>
> 
> In clnt_dg.c in clnt_dg_freeres(), cu_fd_lock->active is set to TRUE, with no
> corresponding clearing when the operation (*xdr_res() call) is completed. This
> would leave other waiting operations blocked indefinitely, effectively
> deadlocking the client. For comparison, clnt_vd_freeres() in clnt_vc.c does not
> set the active state to TRUE. I believe the vc behavior is correct, while the
> dg behavior is a bug.
> 
> Signed-off-by: Attila Kovacs <attipaci@gmail.com>
Committed (tag: libtirpc-1-3-3-rc4)

steved.
> ---
>   src/clnt_dg.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/src/clnt_dg.c b/src/clnt_dg.c
> index 7c5d22e..b2043ac 100644
> --- a/src/clnt_dg.c
> +++ b/src/clnt_dg.c
> @@ -573,7 +573,6 @@ clnt_dg_freeres(cl, xdr_res, res_ptr)
>   	mutex_lock(&clnt_fd_lock);
>   	while (cu->cu_fd_lock->active)
>   		cond_wait(&cu->cu_fd_lock->cv, &clnt_fd_lock);
> -	cu->cu_fd_lock->active = TRUE;
>   	xdrs->x_op = XDR_FREE;
>   	dummy = (*xdr_res)(xdrs, res_ptr);
>   	thr_sigsetmask(SIG_SETMASK, &mask, NULL);
diff mbox series

Patch

diff --git a/src/clnt_dg.c b/src/clnt_dg.c
index 7c5d22e..b2043ac 100644
--- a/src/clnt_dg.c
+++ b/src/clnt_dg.c
@@ -573,7 +573,6 @@  clnt_dg_freeres(cl, xdr_res, res_ptr)
 	mutex_lock(&clnt_fd_lock);
 	while (cu->cu_fd_lock->active)
 		cond_wait(&cu->cu_fd_lock->cv, &clnt_fd_lock);
-	cu->cu_fd_lock->active = TRUE;
 	xdrs->x_op = XDR_FREE;
 	dummy = (*xdr_res)(xdrs, res_ptr);
 	thr_sigsetmask(SIG_SETMASK, &mask, NULL);