]> git.baikalelectronics.ru Git - kernel.git/commit
rpmsg: make sure inflight messages don't invoke just-removed callbacks
authorOhad Ben-Cohen <ohad@wizery.com>
Thu, 7 Jun 2012 12:39:35 +0000 (15:39 +0300)
committerOhad Ben-Cohen <ohad@wizery.com>
Wed, 4 Jul 2012 08:51:59 +0000 (11:51 +0300)
commit0dd1e4cc397c6b9424610940b8a7afd05b4bcce6
treeb35e37da3edf0b0166f14cf1d71e665d506b7fdf
parentd649f602fc88ad21ee85cd0018dfcdd84003aeb1
rpmsg: make sure inflight messages don't invoke just-removed callbacks

When inbound messages arrive, rpmsg core looks up their associated
endpoint (by destination address) and then invokes their callback.

We've made sure that endpoints will never be de-allocated after they
were found by rpmsg core, but we also need to protect against the
(rare) scenario where the rpmsg driver was just removed, and its
callback function isn't available anymore.

This is achieved by introducing a callback mutex, which must be taken
before the callback is invoked, and, obviously, before it is removed.

Cc: stable <stable@vger.kernel.org>
Reported-by: Fernando Guzman Lugo <fernando.lugo@ti.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
drivers/rpmsg/virtio_rpmsg_bus.c
include/linux/rpmsg.h