All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Xie <AlexBin.Xie-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Alex Xie <AlexBin.Xie-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH] dmr/amdgpu: Fix wrongly unref of BO
Date: Thu, 13 Apr 2017 17:34:58 -0400	[thread overview]
Message-ID: <1492119298-8526-1-git-send-email-AlexBin.Xie@amd.com> (raw)

According to comment of amdgpu_bo_reserve, amdgpu_bo_reserve
can return with -ERESTARTSYS. When this function was interrupted
by a signal, BO should not be unref. Otherwise the BO might be
released while is kmapped and pinned, or BO MIGHT be deref
multiple times, etc.

Change-Id: If76071a768950a0d3ad9d5da7fcae04881807621
Signed-off-by: Alex Xie <AlexBin.Xie@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 53996e3..1dcc2d1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -355,8 +355,8 @@ static void amdgpu_vram_scratch_fini(struct amdgpu_device *adev)
 		amdgpu_bo_kunmap(adev->vram_scratch.robj);
 		amdgpu_bo_unpin(adev->vram_scratch.robj);
 		amdgpu_bo_unreserve(adev->vram_scratch.robj);
+		amdgpu_bo_unref(&adev->vram_scratch.robj);
 	}
-	amdgpu_bo_unref(&adev->vram_scratch.robj);
 }
 
 /**
-- 
1.9.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

             reply	other threads:[~2017-04-13 21:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-13 21:34 Alex Xie [this message]
     [not found] ` <1492119298-8526-1-git-send-email-AlexBin.Xie-5C7GfCeVMHo@public.gmane.org>
2017-04-14  4:00   ` [PATCH] dmr/amdgpu: Fix wrongly unref of BO zhoucm1
     [not found]     ` <58F0495D.60607-5C7GfCeVMHo@public.gmane.org>
2017-04-17 14:54       ` Xie, AlexBin
     [not found]         ` <MWHPR1201MB0045DE55E81D0FF5CE76671FF2060-3iK1xFAIwjq45V35fqe+hGrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-04-18  2:38           ` zhoucm1
     [not found]             ` <58F57C14.20403-5C7GfCeVMHo@public.gmane.org>
2017-04-18 15:17               ` Xie, AlexBin
     [not found]                 ` <MWHPR1201MB00452889FF2C7FDC55630B4BF2190-3iK1xFAIwjq45V35fqe+hGrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-04-18 17:46                   ` Christian König
     [not found]                     ` <7807726d-7318-b72f-1a14-2b37a73988bf-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-04-18 18:04                       ` Xie, AlexBin
     [not found]                         ` <MWHPR1201MB00451DFD2A06BBA3CD6F928EF2190-3iK1xFAIwjq45V35fqe+hGrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-04-18 18:54                           ` Xie, AlexBin
     [not found]                             ` <MWHPR1201MB004553768BCAC951D28A347AF2190-3iK1xFAIwjq45V35fqe+hGrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-04-19  6:35                               ` Christian König
     [not found]                                 ` <4509f79a-ffd5-eb40-117c-84ea02cbf5cd-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-04-19 11:37                                   ` Xie, AlexBin
     [not found]                                     ` <MWHPR1201MB0045EC51F6CE7C6C4283888CF2180-3iK1xFAIwjq45V35fqe+hGrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-04-19 11:50                                       ` Christian König
     [not found]                                         ` <2b43e2a9-0c79-f945-c835-0cfc486304c8-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-04-19 19:30                                           ` Xie, AlexBin
     [not found]                                             ` <MWHPR1201MB0045B04F77E1F1C6D37D24FBF2180-3iK1xFAIwjq45V35fqe+hGrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-04-20  8:43                                               ` Christian König
     [not found]                                                 ` <96809715-3c78-3784-fbeb-57a00359e3f3-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-04-20 21:56                                                   ` Xie, AlexBin
     [not found]                                                     ` <MWHPR1201MB004568A33CBF287710759301F21B0-3iK1xFAIwjq45V35fqe+hGrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-04-21  7:11                                                       ` Christian König
     [not found]                                                         ` <af065740-e219-fccb-4dac-d46f3472f4aa-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-04-21 15:43                                                           ` Felix Kuehling
     [not found]                                                             ` <003d5e5f-ea99-4517-fd4a-de4df3ce1b89-5C7GfCeVMHo@public.gmane.org>
2017-04-21 17:01                                                               ` Christian König
     [not found]                                                                 ` <a8715aca-05ff-1262-e2f5-31279052e606-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-04-21 17:53                                                                   ` Felix Kuehling

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=1492119298-8526-1-git-send-email-AlexBin.Xie@amd.com \
    --to=alexbin.xie-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.