[jcifs] Possible deadlocking between jcifs.smb.Dfs and jcifs.smb.SmbTransport [PATCH]

Xavier Roche roche+kml2 at exalead.com
Thu Mar 1 03:24:31 MST 2012


Hi again,

On 02/29/2012 05:42 PM, Xavier Roche wrote:
> [ Issue found in jcifs 1.3.17 ]
> jcifs.smb.Dfs and jcifs.smb.SmbTransport seems to be deadlocking due to
> Mutex ordering mismatch in the code.

The attached patch seems to solve the issue.

Basically, the Dfs.resolve() and Dfs.insert() methods do not need to be 
synchronized, only the "referrals" member needs to be locked (using an 
additional lock, because the member itself can be replaced). This way, 
calls such as getDc() in Dfs.resolve() won't deadlock.

I successfully ran a stress test with 32 threads enumerating a DFS, and 
it seems to work fine.

Could this fix me merged in the next release, if it is good enough ?


Regards,
Xavier
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jcifs-1.3.17-Dfs_deadlock_fix.patch
Type: text/x-patch
Size: 2654 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/jcifs/attachments/20120301/35055329/attachment.bin>


More information about the jCIFS mailing list