Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/xen/xen if grant fails also revoke the grants for p...



details:   https://anonhg.NetBSD.org/src/rev/bde03c4e3f13
branches:  trunk
changeset: 1009156:bde03c4e3f13
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Tue Apr 14 08:21:59 2020 +0000

description:
if grant fails also revoke the grants for previous segments, fixes
grant leak on grant error

diffstat:

 sys/arch/xen/xen/xbd_xenbus.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r d60fa8ba05b8 -r bde03c4e3f13 sys/arch/xen/xen/xbd_xenbus.c
--- a/sys/arch/xen/xen/xbd_xenbus.c     Tue Apr 14 08:06:53 2020 +0000
+++ b/sys/arch/xen/xen/xbd_xenbus.c     Tue Apr 14 08:21:59 2020 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: xbd_xenbus.c,v 1.107 2020/04/13 20:09:13 jdolecek Exp $      */
+/*      $NetBSD: xbd_xenbus.c,v 1.108 2020/04/14 08:21:59 jdolecek Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.107 2020/04/13 20:09:13 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.108 2020/04/14 08:21:59 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -1049,6 +1049,12 @@
                    &xbdreq->req_gntref[seg]))) {
                        printf("%s: %s: xengnt_grant_access failed",
                            device_xname(sc->sc_dksc.sc_dev), __func__);
+                       if (seg > 0) {
+                               for (; --seg >= 0; ) {
+                                       xengnt_revoke_access(
+                                           xbdreq->req_gntref[seg]);
+                               }
+                       }
                        bus_dmamap_unload(sc->sc_xbusd->xbusd_dmat,
                            xbdreq->req_dmamap);
                        SLIST_INSERT_HEAD(&sc->sc_xbdreq_head, xbdreq,



Home | Main Index | Thread Index | Old Index