Re: [PATCH 1/2] wifi: ath11k: fix temperature event locking

From: Johan Hovold
Date: Thu Oct 19 2023 - 11:17:43 EST


On Thu, Oct 19, 2023 at 08:04:55AM -0700, Jeff Johnson wrote:
> On 10/19/2023 3:42 AM, Johan Hovold wrote:
> > The ath11k active pdevs are protected by RCU but the temperature event
> > handling code calling ath11k_mac_get_ar_by_pdev_id() was not marked as a
> > read-side critical section as reported by RCU lockdep:
>
> How do I enable this? Just enable CONFIG_PROVE_RCU?

Yeah, via CONFIG_PROVE_LOCKING.

> Of course I'd also need to exercise the code path...

Right, this one I hit when reading out the sensor temperature (e.g.
using lm_sensors).

> > + rcu_read_lock();
> > +
> > ar = ath11k_mac_get_ar_by_pdev_id(ab, ev->pdev_id);
> > if (!ar) {
> > ath11k_warn(ab, "invalid pdev id in pdev temperature ev %d", ev->pdev_id);
>
> aren't you missing an unlock() in this error path?
>
> perhaps have a goto cleanup that does both the unlock() and the kfree()?

Bah, I am, thanks for catching that.

Spent too much time on scanning for further instances that I didn't
check the first one properly. Sorry about that. Will send a v2.

Johan