Merge tag 'rproc-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ohad...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 16 May 2012 21:26:05 +0000 (14:26 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 16 May 2012 21:26:05 +0000 (14:26 -0700)
Pull remoteproc fix from Ohad Ben-Cohen:
 "Fix a nasty off-by-one remoteproc bug which leaks memory when a remote
  processor is shut down and, on certain circumstances, can indirectly
  prevent it from being reloaded."

* tag 'rproc-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ohad/remoteproc:
  remoteproc: fix off-by-one bug in __rproc_free_vrings

drivers/remoteproc/remoteproc_core.c

index ee15c68..e756a0d 100644 (file)
@@ -354,7 +354,7 @@ static void __rproc_free_vrings(struct rproc_vdev *rvdev, int i)
 {
        struct rproc *rproc = rvdev->rproc;
 
-       for (i--; i > 0; i--) {
+       for (i--; i >= 0; i--) {
                struct rproc_vring *rvring = &rvdev->vring[i];
                int size = PAGE_ALIGN(vring_size(rvring->len, rvring->align));