From: Ohad Ben-Cohen Date: Wed, 6 Jun 2012 07:09:25 +0000 (+0300) Subject: rpmsg: avoid premature deallocation of endpoints X-Git-Tag: v3.5-rc7~40^2~1 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a081caa0414b9bbb82c17ffab9d6fe66edbb72f;p=pandora-kernel.git rpmsg: avoid premature deallocation of endpoints When an inbound message arrives, the rpmsg core looks up its associated endpoint and invokes the registered callback. If a message arrives while its endpoint is being removed (because the rpmsg driver was removed, or a recovery of a remote processor has kicked in) we must ensure atomicity, i.e.: - Either the ept is removed before it is found or - The ept is found but will not be freed until the callback returns This is achieved by maintaining a per-ept reference count, which, when drops to zero, will trigger deallocation of the ept. With this in hand, it is now forbidden to directly deallocate epts once they have been added to the endpoints idr. Cc: stable Reported-by: Fernando Guzman Lugo Signed-off-by: Ohad Ben-Cohen --- Reading git-diff-tree failed