[PATCH] setupapi: Avoid race conditions with devnode_table.

Brendan Shanks bshanks at codeweavers.com
Tue Feb 8 17:06:08 CST 2022


> On Feb 8, 2022, at 11:47 AM, Zebediah Figura (she/her) <zfigura at codeweavers.com> wrote:
> 
> On 2/8/22 13:33, Brendan Shanks wrote:
>> Signed-off-by: Brendan Shanks <bshanks at codeweavers.com>
>> ---
>> Fixes a crash where two threads calling SetupDiGetClassDevs() would end
>> up in alloc_devnode() at the same time. One thread would start iterating
>> through the table after devnode_table_size was set but before
>> devnode_table was allocated, and crash.
> 
> If we need setupapi to be thread-safe, does it make sense just to put a lock around all devinst functions instead?

I’m not super familiar with setupapi, but that seems like it would be overkill to me. The only process-wide state accessed by the devinst functions seems to be the devnode_table and the registry, which a lock won’t stop from being modified by a different process (like winedevice).

Brendan


More information about the wine-devel mailing list