2009-07-13 19:35:04

by Jiri Slaby

[permalink] [raw]
Subject: iwl: potential deadlock?

Hi,

we found a potential deadlock in iwl code by our tool.

Can this happen:
iwl_update_tkip_key()
-> spin_lock_irqsave(&priv->sta_lock)
-> iwl_send_add_sta()
-> iwl_sta_ucode_activate()
-> spin_lock_irqsave(&priv->sta_lock)
?

Thanks.


2009-07-13 20:18:43

by Reinette Chatre

[permalink] [raw]
Subject: Re: iwl: potential deadlock?

Hi Jiri,

On Mon, 2009-07-13 at 12:34 -0700, Jiri Slaby wrote:
> Hi,
>
> we found a potential deadlock in iwl code by our tool.

What tool is this?

>
> Can this happen:

I don't think so ...

> iwl_update_tkip_key()
> -> spin_lock_irqsave(&priv->sta_lock)
> -> iwl_send_add_sta()

iwl_send_add_sta() is called here with flags = CMD_ASYNC

In iwl_send_add_sta() we have:
if (ret || (flags & CMD_ASYNC))
return ret;

> -> iwl_sta_ucode_activate()

... so this is not run in this case.

> -> spin_lock_irqsave(&priv->sta_lock)

Reinette

2009-07-13 20:33:10

by Jiri Slaby

[permalink] [raw]
Subject: Re: iwl: potential deadlock?

On 07/13/2009 10:18 PM, reinette chatre wrote:
> On Mon, 2009-07-13 at 12:34 -0700, Jiri Slaby wrote:
>> we found a potential deadlock in iwl code by our tool.
>
> What tool is this?

It's called stanse[1], we still work on it.

>> iwl_update_tkip_key()
>> -> spin_lock_irqsave(&priv->sta_lock)
>> -> iwl_send_add_sta()
>
> iwl_send_add_sta() is called here with flags = CMD_ASYNC
>
> In iwl_send_add_sta() we have:
> if (ret || (flags & CMD_ASYNC))
> return ret;

Yes, you're right, indeed. Thanks for the explanation.

[1] http://iti.fi.muni.cz/stanse/