Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/drm2/dist/drm/ttm drm/ttm: Fix potential le...



details:   https://anonhg.NetBSD.org/src/rev/9257c0e20c4e
branches:  trunk
changeset: 368168:9257c0e20c4e
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Jun 26 17:53:06 2022 +0000

description:
drm/ttm: Fix potential leak in error branch.

Not likely but let's not leave a rake to trip on.

diffstat:

 sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r 811b433ca5a4 -r 9257c0e20c4e sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c
--- a/sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c       Sun Jun 26 17:52:54 2022 +0000
+++ b/sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c       Sun Jun 26 17:53:06 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ttm_tt.c,v 1.18 2021/12/19 12:29:16 riastradh Exp $    */
+/*     $NetBSD: ttm_tt.c,v 1.19 2022/06/26 17:53:06 riastradh Exp $    */
 
 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
 /**************************************************************************
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ttm_tt.c,v 1.18 2021/12/19 12:29:16 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttm_tt.c,v 1.19 2022/06/26 17:53:06 riastradh Exp $");
 
 #define pr_fmt(fmt) "[TTM] " fmt
 
@@ -112,8 +112,11 @@
 
        /* Create bus DMA map at ttm->dma_address.  */
        r = ttm_sg_tt_alloc_page_directory(ttm);
-       if (r)
+       if (r) {
+               kvfree(ttm->ttm.pages);
+               ttm->ttm.pages = NULL;
                return r;
+       }
 
        /* Success!  */
        return 0;



Home | Main Index | Thread Index | Old Index