linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Xen/gntdev: don't ignore kernel unmapping error
@ 2021-09-17  6:13 Jan Beulich
  2021-09-17  7:35 ` Juergen Gross
  2021-09-20 15:18 ` Juergen Gross
  0 siblings, 2 replies; 3+ messages in thread
From: Jan Beulich @ 2021-09-17  6:13 UTC (permalink / raw)
  To: Juergen Gross, Boris Ostrovsky; +Cc: Stefano Stabellini, lkml, xen-devel

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>
---
It is of course questionable whether zapping handles even upon failure
is the best course of action. Otoh unmapping shouldn't normally fail
unless there's a bug elsewhere (which is how I came to notice this
discrepancy).

--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -396,6 +396,14 @@ static int __unmap_grant_pages(struct gn
 			map->unmap_ops[offset+i].handle,
 			map->unmap_ops[offset+i].status);
 		map->unmap_ops[offset+i].handle = INVALID_GRANT_HANDLE;
+		if (use_ptemod) {
+			if (map->kunmap_ops[offset+i].status)
+				err = -EINVAL;
+			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 = INVALID_GRANT_HANDLE;
+		}
 	}
 	return err;
 }


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Xen/gntdev: don't ignore kernel unmapping error
  2021-09-17  6:13 [PATCH] Xen/gntdev: don't ignore kernel unmapping error Jan Beulich
@ 2021-09-17  7:35 ` Juergen Gross
  2021-09-20 15:18 ` Juergen Gross
  1 sibling, 0 replies; 3+ messages in thread
From: Juergen Gross @ 2021-09-17  7:35 UTC (permalink / raw)
  To: Jan Beulich, Boris Ostrovsky; +Cc: Stefano Stabellini, lkml, xen-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 393 bytes --]

On 17.09.21 08:13, Jan Beulich wrote:
> 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>


Juergen


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3135 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Xen/gntdev: don't ignore kernel unmapping error
  2021-09-17  6:13 [PATCH] Xen/gntdev: don't ignore kernel unmapping error Jan Beulich
  2021-09-17  7:35 ` Juergen Gross
@ 2021-09-20 15:18 ` Juergen Gross
  1 sibling, 0 replies; 3+ messages in thread
From: Juergen Gross @ 2021-09-20 15:18 UTC (permalink / raw)
  To: Jan Beulich, Boris Ostrovsky; +Cc: Stefano Stabellini, lkml, xen-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 384 bytes --]

On 17.09.21 08:13, Jan Beulich wrote:
> 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>

Pushed to xen/tip.git for-linus-5.15b


Juergen

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3135 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-20 15:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-17  6:13 [PATCH] Xen/gntdev: don't ignore kernel unmapping error Jan Beulich
2021-09-17  7:35 ` Juergen Gross
2021-09-20 15:18 ` Juergen Gross

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).