From: Demi Marie Obenour <demi@invisiblethingslab.com>
To: "Juergen Gross" <jgross@suse.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Oleksandr Tyshchenko" <oleksandr_tyshchenko@epam.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Sasha Levin" <sashal@kernel.org>,
"Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
Cc: Jan Beulich <jbeulich@suse.com>,
xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org,
Demi Marie Obenour <demi@invisiblethingslab.com>
Subject: [PATCH 1/3] Xen/gntdev: don't ignore kernel unmapping error
Date: Sun, 30 Oct 2022 03:12:41 -0400 [thread overview]
Message-ID: <20221030071243.1580-2-demi@invisiblethingslab.com> (raw)
In-Reply-To: <20221030071243.1580-1-demi@invisiblethingslab.com>
From: Jan Beulich <jbeulich@suse.com>
commit f28347cc66395e96712f5c2db0a302ee75bafce6 upstream.
While working on XSA-361 and its follow-ups, I failed to spot another
place where the kernel mapping part of an operation was not treated the
same as the user space part. Detect and propagate errors and add a 2nd
pr_debug().
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/c2513395-74dc-aea3-9192-fd265aa44e35@suse.com
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
Co-authored-by: Demi Marie Obenour <demi@invisiblethingslab.com>
---
drivers/xen/gntdev.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
index 54fee4087bf1078803c230ad2081aafa8415cf53..8cf9f2074c5d57bff81364d7d6a70b0007a85e44 100644
--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -407,6 +407,14 @@ static void __unmap_grant_pages_done(int result,
map->unmap_ops[offset+i].handle,
map->unmap_ops[offset+i].status);
map->unmap_ops[offset+i].handle = -1;
+ if (use_ptemod) {
+ WARN_ON(map->kunmap_ops[offset+i].status &&
+ map->kunmap_ops[offset+i].handle != -1);
+ pr_debug("kunmap handle=%u st=%d\n",
+ map->kunmap_ops[offset+i].handle,
+ map->kunmap_ops[offset+i].status);
+ map->kunmap_ops[offset+i].handle = -1;
+ }
}
/*
* Decrease the live-grant counter. This must happen after the loop to
--
2.38.1
next prev parent reply other threads:[~2022-10-30 7:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-30 7:12 [PATCH 0/3] Stable backports of gntdev fixes Demi Marie Obenour
2022-10-30 7:12 ` Demi Marie Obenour [this message]
2022-10-30 7:12 ` [PATCH 2/3] xen/gntdev: Prevent leaking grants Demi Marie Obenour
2022-10-30 7:12 ` [PATCH 3/3] xen/gntdev: Accommodate VMA splitting Demi Marie Obenour
2022-10-31 7:24 ` Greg Kroah-Hartman
2022-10-31 20:27 ` Demi Marie Obenour
2022-10-31 7:24 ` [PATCH 0/3] Stable backports of gntdev fixes Greg Kroah-Hartman
2022-10-31 20:22 ` Demi Marie Obenour
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221030071243.1580-2-demi@invisiblethingslab.com \
--to=demi@invisiblethingslab.com \
--cc=gregkh@linuxfoundation.org \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marmarek@invisiblethingslab.com \
--cc=oleksandr_tyshchenko@epam.com \
--cc=sashal@kernel.org \
--cc=sstabellini@kernel.org \
--cc=stable@vger.kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox