Hi All,

        valgrind reported that clnt_vc_geterr() is accessing freed memory.
Code review shows that nlm_send_async() calls clnt_call() and then calls
clnt_sperror() on some errors. This is clearly a bug to access rpc context
memory that was freed in a prior call. I am not familiar with RPC code,
it should be an easy fix for someone familiar with RPC code. Can someone
please fix or give pointers to fix it.

Here is the entire valgrind report (ran against V2.2-stable, but line
numbers should NOT change that much).

==7012== Thread 35:
==7012== Invalid read of size 8
==7012==    at 0x535704: clnt_vc_geterr (clnt_vc.c:582)
==7012==    by 0x533FFB: clnt_sperror (clnt_perror.c:83)
==7012==    by 0x48FF07: nlm_send_async (nlm_async.c:283)
==7012==    by 0x491132: nlm4_send_grant_msg (nlm_util.c:205)
==7012==    by 0x49B203: state_async_func_caller (state_async.c:81)
==7012==    by 0x508E5A: fridgethr_start_routine (fridgethr.c:562)
==7012==    by 0x61EEDF2: start_thread (in /usr/lib64/libpthread-2.17.so)
==7012==    by 0x67011AC: clone (in /usr/lib64/libc-2.17.so)
==7012==  Address 0x87f5a88 is 136 bytes inside a block of size 184 free'd
==7012==    at 0x4C29577: free (in 
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==7012==    by 0x53AAB9: free_rpc_call_ctx (rpc_ctx.c:251)
==7012==    by 0x5356B3: clnt_vc_call (clnt_vc.c:567)
==7012==    by 0x48FE71: nlm_send_async (nlm_async.c:267)
==7012==    by 0x491132: nlm4_send_grant_msg (nlm_util.c:205)
==7012==    by 0x49B203: state_async_func_caller (state_async.c:81)
==7012==    by 0x508E5A: fridgethr_start_routine (fridgethr.c:562)
==7012==    by 0x61EEDF2: start_thread (in /usr/lib64/libpthread-2.17.so)
==7012==    by 0x67011AC: clone (in /usr/lib64/libc-2.17.so)

Regards, Malahal.
PS: I can make the context pointer NULL when we free, and use xdrs->x_lib[1]
in the check instead of xdrs->x_lib[0] in clnt_vc_geterr(). Wonder if that is a 
right method.


------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
Nfs-ganesha-devel mailing list
Nfs-ganesha-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs-ganesha-devel

Reply via email to