Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2279899ybl; Thu, 19 Dec 2019 10:56:13 -0800 (PST) X-Google-Smtp-Source: APXvYqzZlBOW5xsFi9j9z6BEyOQPS7qf2xul7YQ5bF/NmbKP7Ikanvw8pRguLDPiFKvFJNqJSO93 X-Received: by 2002:a9d:32e:: with SMTP id 43mr10218360otv.301.1576781772865; Thu, 19 Dec 2019 10:56:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576781772; cv=none; d=google.com; s=arc-20160816; b=QfTrZ0fpfrW1dmVqZe6FtL4TY3T/1KuLxJ0a2RsF0CK6Pka/9A8CZMK6Ip8XRcJ+ek 7W2WFopMJYa3V11kQbi8aFc6vYJMHkr3f14nsplaRNUuMd4rEnFSuxFuBGvWtH+Pvsm/ P8Rx7LK8oVEsqGnexYcKqhJVcyJy9eTxHjoR20CPtqQRCCdeoo/dQ1fHNdgoutt0xrtp Fbysv4ZqXPPsh1Z/GIGEJmx+4P+U2xH/joWkSiqSuFBKm9aSATO+tcqv/z1pGy05HlcB b2VHNEZuQnZu7uqNcrDqAQRnlcg1J9FAImgBU404td62s3+GkndhEBgJGgNOrI8Ih497 SKWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=N+Epvn9RCdyQitdQnZkudK2ZeDlUWxVFl8osflB20DI=; b=NjAsl7xb99O5M2VS9EjwG5BPHrerCTyBX39XuyIYIxIInwOV7UvRpRM1/VPsQepVMJ vRDVU4zOM3LgFmiXDBzIcyT0S+RxT6DDiXx37WhuY3cVICOQNWdMJOsEZWmz2DBck6lc 9wIsJdc9zH3WXqvwVD9YJiuWDG7vgs4OczO5wECbCXOwqWnA73CzxnJ6MMN+lCxq/xWb yHBlz87o8eGIFZElP4a3yGPjn04XVC4APp9Ie06eHz06QcIuFNcqj78MOmhGecDEPznG E3/smlEiQ4ZsDP+lMcYHCYapuZrWtVqSkomSWBJhEmwXzsV6jDQTQ4pKg7jwlaFqzq6e VIlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UwWk3aj8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f22si1302258otp.178.2019.12.19.10.56.00; Thu, 19 Dec 2019 10:56:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UwWk3aj8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730593AbfLSSy7 (ORCPT + 99 others); Thu, 19 Dec 2019 13:54:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:50598 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728670AbfLSSy6 (ORCPT ); Thu, 19 Dec 2019 13:54:58 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 07F932465E; Thu, 19 Dec 2019 18:54:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576781697; bh=2psHlqRzmmA3xx2kZl7EqC/jBdJeenrOy2m5Qcvq0PM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UwWk3aj80uzbZdJmSChR5C+VRn3cOj5/l9ZJzJ8Nt8Wkbk3+pT6b1T4iumJunUpGU l9nk0gZLxylMICVjaeXhm+y+tcBCT63y7SCK7xkq9gwC9G0ydKC2WfUkJNDAdWc+0U bHNoKoaZrcTrYZKhyyvLnXqUbHQ8DgpKzHVc4B9I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Boris Brezillon , Steven Price , Alyssa Rosenzweig , Rob Herring Subject: [PATCH 5.4 44/80] drm/panfrost: Fix a BO leak in panfrost_ioctl_mmap_bo() Date: Thu, 19 Dec 2019 19:34:36 +0100 Message-Id: <20191219183111.994129838@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191219183031.278083125@linuxfoundation.org> References: <20191219183031.278083125@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Boris Brezillon commit 3bb69dbcb9e8430e0cc9990cff427ca3ae25ffdc upstream. We should release the reference we grabbed when an error occurs. Fixes: 187d2929206e ("drm/panfrost: Add support for GPU heap allocations") Cc: Signed-off-by: Boris Brezillon Reviewed-by: Steven Price Acked-by: Alyssa Rosenzweig Signed-off-by: Rob Herring Link: https://patchwork.freedesktop.org/patch/msgid/20191129135908.2439529-4-boris.brezillon@collabora.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/panfrost/panfrost_drv.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/drivers/gpu/drm/panfrost/panfrost_drv.c +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c @@ -303,14 +303,17 @@ static int panfrost_ioctl_mmap_bo(struct } /* Don't allow mmapping of heap objects as pages are not pinned. */ - if (to_panfrost_bo(gem_obj)->is_heap) - return -EINVAL; + if (to_panfrost_bo(gem_obj)->is_heap) { + ret = -EINVAL; + goto out; + } ret = drm_gem_create_mmap_offset(gem_obj); if (ret == 0) args->offset = drm_vma_node_offset_addr(&gem_obj->vma_node); - drm_gem_object_put_unlocked(gem_obj); +out: + drm_gem_object_put_unlocked(gem_obj); return ret; }