Should be cc'ed to netfilter-devel; now done. ---------- Forwarded message ---------- Date: Sun, 2 Dec 2012 08:21:08 From: Feng Gao <FGao@xxxxxxxxxxxxxxx> To: laforge, jengelh Subject: One issue in the xt_hashlimit.c Hi Harald & Jan, I am a programmer in China. I read the codes of netfilter recently, and find one potent issue in the funciton "hashlimit_mt", file "xt_hashlimit.c". The following codes are from function "hashlimit_mt". dh = dsthash_find(hinfo, &dst); if (dh == NULL) { dh = dsthash_alloc_init(hinfo, &dst); When two or more threads invoke dsthash_find(hinfo, &dst) at the same time and fail to find the dh, then all of them will enter the dsthash_alloc_init to create one new node. As a result, it will casue that these multiple threads create multle nodes with same IP. It is not expected behavior. we should add the check in the fucntion "dsthash_alloc_init" to if the node has been already created in the function to fix it. The attachment is my fix. Best Regards Feng
Attachment:
xt_hashlimit.diff
Description: xt_hashlimit.diff