From patchwork Sat Feb 4 07:07:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Liu, Monk" X-Patchwork-Id: 9557005 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 712B06021C for ; Mon, 6 Feb 2017 01:26:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63556269E2 for ; Mon, 6 Feb 2017 01:26:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57F6226D05; Mon, 6 Feb 2017 01:26:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, HTML_MESSAGE, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CAB67269E2 for ; Mon, 6 Feb 2017 01:26:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8DD946E2BF; Mon, 6 Feb 2017 01:24:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 5527 seconds by postgrey-1.35 at gabe; Sat, 04 Feb 2017 08:39:56 UTC Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0044.outbound.protection.outlook.com [104.47.40.44]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3CFF36E177 for ; Sat, 4 Feb 2017 08:39:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Uew388wA5v4TKn+JBA3coMEGkUfvul4vExPkEWpNre4=; b=cRH5VA3/93v7hs+HJk+FcM1GnRroQYGRRbZ5+7ohlAq9ODcbzyLX7qcJZ5hiKGw28rTTvPhiGiVIGamnpcToMlkm2etv5DsXn6r6kiEVSKBXkYkRMlJmf7TX81LdGMKJ/v4dswHMBLHTPc7eyOoGmOILpyoE5vLdB4DPbXWvWGU= Received: from DM5PR12MB1610.namprd12.prod.outlook.com (10.172.40.16) by DM5PR12MB1660.namprd12.prod.outlook.com (10.172.40.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.874.12; Sat, 4 Feb 2017 07:07:46 +0000 Received: from DM5PR12MB1610.namprd12.prod.outlook.com ([10.172.40.16]) by DM5PR12MB1610.namprd12.prod.outlook.com ([10.172.40.16]) with mapi id 15.01.0888.020; Sat, 4 Feb 2017 07:07:45 +0000 From: "Liu, Monk" To: Colin King , "Deucher, Alexander" , "Koenig, Christian" , David Airlie , "Yu, Xiangliang" , "amd-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" Subject: =?gb2312?B?tPC4tDogW1BBVENIXSBkcm0vYW1kZ3B1L3ZpcnQ6IGZpeCBkb3VibGUga2Zy?= =?gb2312?Q?ee_on_bo=5Fva?= Thread-Topic: [PATCH] drm/amdgpu/virt: fix double kfree on bo_va Thread-Index: AQHSflug14lFx/kX2k2liDhJnGYRrqFYbcTZ Date: Sat, 4 Feb 2017 07:07:45 +0000 Message-ID: References: <20170203202342.13128-1-colin.king@canonical.com> In-Reply-To: <20170203202342.13128-1-colin.king@canonical.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Monk.Liu@amd.com; x-originating-ip: [116.228.147.241] x-microsoft-exchange-diagnostics: 1; DM5PR12MB1660; 7:eMUSmHny0ih4PUnVXJS81XuEKQwzfxFssTGuDbNJnKs1c9pOFaUjw+bh0RCdlVjvIvlQDv9FJeRqOgBkz+4bYwg485KBZvG0IxKrGVUzf2fG46Kz6xsDeGQ+C5e6C1w3qIiMRKIXUoLrbUM06OyqIjE5WZvBjiPTzNP98ax9IMq5h7BkItj4eDQn5ehc7yKuRSKavfYpKolmKdMc3s9QLEeYkGRjdlTA1vzsW2Ho5pGD2r9pMtjYFDNBcQgyhxERKNZbIJH7uHcNfVAEEtEMDW4ThGbnnqZABzV+d5IAZ2I4v9SfxfPqB4xhT6alrpf5lTNoF4Mn6tTOpMc6xmiWZMy0x8s+oMWjaADbYTTpvQB8uCzKLCUwdKQFgc4efBXKAh20ypo7EczMLW69eo7BcYDkDATKKz5GbBrIjUwwJtc99EuQK+11x4ic9R0lAr/wYlpns3eum1zp56rUmfmYNnuxIUEufQqAgSyxw/hYkJ7SCy0DV49PTyye/cajaKSg8q0mW9vhmg4MXLo40N5Umw==; 20:7DQEI/ym+3Tn+mYhG9pYxdPlpbXqFnbEPk+VC+isBJs/hmaVkXpmj7f6fp7j8iNxN9TnS9v8wdudR7VjuI6gpZSryZPwTTglw03keYgpe6tUGUnuXdHUP7UUjPf+5iBAvohZN941l8/ArYu/x854iXxUrmRDtv/Z9PaqyzbWS943ihXkNvMVZPdonzF/EeIXlTHP8Ze6327VU4PWbd50sr1dD23HQdmnAQZhIPe+Uyp6AwNPsHESzhLHL/7p+GY+ x-forefront-antispam-report: SFV:SKI; SCL:-1SFV:NSPM; SFS:(10009020)(6009001)(7916002)(39450400003)(39860400002)(39840400002)(39410400002)(39850400002)(189002)(199003)(33656002)(5001770100001)(106116001)(105586002)(224303003)(106356001)(81166006)(81156014)(53936002)(3660700001)(8936002)(101416001)(9686003)(54906002)(54356999)(54896002)(99286003)(55016002)(68736007)(50986999)(97736004)(76176999)(92566002)(2900100001)(66066001)(7696004)(189998001)(122556002)(3280700002)(2906002)(86362001)(2501003)(6436002)(6116002)(38730400001)(102836003)(4326007)(7736002)(2950100002)(25786008)(74316002)(77096006)(5660300001)(16234385003)(2201001)(3846002)(6506006)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB1660; H:DM5PR12MB1610.namprd12.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; x-ms-office365-filtering-correlation-id: 5ae1bcde-5433-46e9-c42b-08d44ccc84e3 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081); SRVR:DM5PR12MB1660; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(158342451672863)(9452136761055)(767451399110)(217544274631240)(198206253151910); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026)(6041248)(20161123558025)(20161123564025)(20161123555025)(20161123560025)(20161123562025)(6072148); SRVR:DM5PR12MB1660; BCL:0; PCL:0; RULEID:; SRVR:DM5PR12MB1660; x-forefront-prvs: 020877E0CB received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Feb 2017 07:07:45.0769 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1660 X-Mailman-Approved-At: Mon, 06 Feb 2017 01:24:20 +0000 Cc: "kernel-janitors@vger.kernel.org" , "linux-kernel@vger.kernel.org" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP thanks for this catch! Reviewed-by: Monk Liu ________________________________ 发件人: Colin King 发送时间: 2017年2月4日 4:23:42 收件人: Deucher, Alexander; Koenig, Christian; David Airlie; Liu, Monk; Yu, Xiangliang; amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org 抄送: kernel-janitors@vger.kernel.org; linux-kernel@vger.kernel.org 主题: [PATCH] drm/amdgpu/virt: fix double kfree on bo_va From: Colin Ian King bo_va is being kfree'd twice, once in the call to amdgpu_vm_bo_rmv and then a short while later. Fix this double free by removing the 2nd kfree. Detected by CoverityScan, CID#1399524 ("Double Free") Signed-off-by: Colin Ian King --- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 1 - 1 file changed, 1 deletion(-) -- 2.10.2 diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c index 3fd951c..dcfb7df 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c @@ -83,7 +83,6 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm) DRM_ERROR("failed to do bo_map on static CSA, err=%d\n", r); amdgpu_vm_bo_rmv(adev, bo_va); ttm_eu_backoff_reservation(&ticket, &list); - kfree(bo_va); return r; }