rx: Avoid leaking 'sq' in libafs rx_GetCall

Currently, in rx_GetCall when building for the kernel, if we notice
that we're shutting down (that is, if afs_termState has reached
AFSOP_STOP_RXCALLBACK), we return immediately. However, 'sq' may have
been allocated much earlier in this function, and if we return here,
we never free 'sq' or set it on any list.

Returning immediately is also unnecessary here; if we just 'break' out
of our wait loop, 'call' will still be NULL, and we'll break out of
the outer loop, and go through the rest of the function like normal.
The only difference is, if we 'break' instead of 'return'ing, we'll
put 'sq' on the free list before returning.

So, just 'break' out of the loop instead of returning, so we put 'sq'
on the free list and avoid leaking its memory.

Change-Id: Ibb2f4e697a586392f76ccdbbefdae8d75740f6fe
Reviewed-on: https://gerrit.openafs.org/13715
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
Andrew Deason 2019-07-21 21:15:11 -05:00 committed by Benjamin Kaduk
parent 9eeb3ec09f
commit 2df2de06e5

View File

@ -2131,8 +2131,7 @@ rx_GetCall(int tno, struct rx_service *cur_service, osi_socket * socketp)
CV_WAIT(&sq->cv, &rx_serverPool_lock);
#ifdef KERNEL
if (afs_termState == AFSOP_STOP_RXCALLBACK) {
MUTEX_EXIT(&rx_serverPool_lock);
return (struct rx_call *)0;
break;
}
#endif
} while (!(call = sq->newcall)