Patch "xen/gntdevt: Fix race condition in gntdev_release()" has been added to the 3.10-stable tree
From: gregkh@linuxfoundation.org
Date: 2015-08-13 23:32:26
This is a note to let you know that I've just added the patch titled
xen/gntdevt: Fix race condition in gntdev_release()
to the 3.10-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
xen-gntdevt-fix-race-condition-in-gntdev_release.patch
and it can be found in the queue-3.10 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let [off-list ref] know about it.
From 30b03d05e07467b8c6ec683ea96b5bffcbcd3931 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= [off-list ref] Date: Fri, 26 Jun 2015 03:28:24 +0200 Subject: xen/gntdevt: Fix race condition in gntdev_release() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= commit 30b03d05e07467b8c6ec683ea96b5bffcbcd3931 upstream. While gntdev_release() is called the MMU notifier is still registered and can traverse priv->maps list even if no pages are mapped (which is the case -- gntdev_release() is called after all). But gntdev_release() will clear that list, so make sure that only one of those things happens at the same time. Signed-off-by: Marek Marczykowski-Górecki <redacted> Signed-off-by: David Vrabel <redacted> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/xen/gntdev.c | 2 ++ 1 file changed, 2 insertions(+)
--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c@@ -534,12 +534,14 @@ static int gntdev_release(struct inode * pr_debug("priv %p\n", priv); + mutex_lock(&priv->lock); while (!list_empty(&priv->maps)) { map = list_entry(priv->maps.next, struct grant_map, next); list_del(&map->next); gntdev_put_map(NULL /* already removed */, map); } WARN_ON(!list_empty(&priv->freeable_maps)); + mutex_unlock(&priv->lock); if (use_ptemod) mmu_notifier_unregister(&priv->mn, priv->mm);
Patches currently in stable-queue which might be from marmarek@invisiblethingslab.com are queue-3.10/xen-gntdevt-fix-race-condition-in-gntdev_release.patch