greybus: gb_connections_lock: don't use spin_lock_irq()
authorViresh Kumar <viresh.kumar@linaro.org>
Thu, 23 Jun 2016 17:53:06 +0000 (23:23 +0530)
committerGreg Kroah-Hartman <gregkh@google.com>
Thu, 23 Jun 2016 22:30:45 +0000 (15:30 -0700)
commit6f7f2ae5df786bf9ced3247fda51a0a7aeb9cd0c
tree16168a18dd7d0ae0f3c081079cf7e81853c0bdec
parentfe9054155d831fee7a8e737ff3898c4bc2e5fc4d
greybus: gb_connections_lock: don't use spin_lock_irq()

spin_[un]lock_irq() routines should be used carefully as they things can
go wrong, if they are mixed with spin_lock_irqsave() or other variants.

The main problem is that spin_[un]lock_irq() routines doesn't check if
the IRQs are already disabled/enabled on the local CPU and so
spin_unlock_irq() will forcefully enable interrupts for example.

This may not work well, if some other code was relying on interrupts
being disabled.

Use spin_lock_irqsave() and spin_unlock_restore() instead.

This patch doesn't claim that it fixes the JIRA completely, but
the issue was harder to reproduce for some iterations after this, which
was quite easy to reproduce earlier on.

Tested on EVT 2.0 with lots of debug patches to kernel and greybus.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/connection.c