From patchwork Fri Oct 4 10:17:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nirmoy Das X-Patchwork-Id: 11175751 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9062413BD for ; Sat, 5 Oct 2019 16:38:21 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7863C2246A for ; Sat, 5 Oct 2019 16:38:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7863C2246A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 453106E3B8; Sat, 5 Oct 2019 16:37:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id DF9496EB11 for ; Fri, 4 Oct 2019 10:17:55 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id a6so5198722wma.5 for ; Fri, 04 Oct 2019 03:17:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5Vcf+UVY2rqjJRPiANDeBRpXqOSdb6/jb+sfnhdp7MM=; b=Mle9y9IDAehfGFtey9dsdluxGZIFEWlqAJIhl9yNXQOd8ajReTScVDH221bRUjJMZP bFBcRCW52MPwgKz6LItUxGiwvA3Hbl9JijgviYcwQBvneOJlIME1rLGVAz55UpCF4TPH EqysPefu1D6Akaq/IkOrT8ElVEebep1QxFLlfIItL/Ajn00sy03Be2lo2vFbku9BKQrD xGQcR4fi3o0e2xHjLcVgUgB6Sh7zfzJUPL5Wy5mVheuHdAHZnVcjZ2anok1aU8s1/CeC MM4K8a2rRPRMNms9llUulP2AcYX0oRDGAI3NBQD5ZRBTl6r6iplso2uU77vR/KieHy+6 jdEg== X-Gm-Message-State: APjAAAXQuknR/0QntDMzxSmhmbKO2tlSHbaBR3TPJ6CTjcmjDu0/h41W 2pbCzmIqzl+UsDLQUaWtP31idI/a/go7Fw== X-Google-Smtp-Source: APXvYqyOe3FXbS45/9CxnBvy82+J1R+6Ye4lJbdrFwXRJC0rYLNRsJ1HE34LHIbyZYreSgkDWSBc+A== X-Received: by 2002:a7b:caaa:: with SMTP id r10mr10829469wml.100.1570184274042; Fri, 04 Oct 2019 03:17:54 -0700 (PDT) Received: from brihaspati.fritz.box (p5DE53CC9.dip0.t-ipconnect.de. [93.229.60.201]) by smtp.gmail.com with ESMTPSA id t18sm5278823wmi.44.2019.10.04.03.17.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Oct 2019 03:17:53 -0700 (PDT) From: Nirmoy Das X-Google-Original-From: Nirmoy Das To: alexander.deucher@amd.com, christian.koenig@amd.com Subject: [PATCH] drm/amdgpu: fix memory leak Date: Fri, 4 Oct 2019 12:17:46 +0200 Message-Id: <20191004101746.19574-1-nirmoy.das@amd.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-Mailman-Approved-At: Sat, 05 Oct 2019 16:37:30 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5Vcf+UVY2rqjJRPiANDeBRpXqOSdb6/jb+sfnhdp7MM=; b=vJpW+xhTbLcgoLYjISojp3oyFM70IqtJPOBBYFcbZkhWynU5Z8bYhxHuN7YednMisa 64/5PGDK2NwVv58w7wEsVJGBRp8laLhuJYKH2nt+XqCq3wUhz2H/OLJndPRKfsSQuPDd UcntM3z55GL+5uq6zUXU8jJoSpiE30YqO0ZKM7OqWmjjUAeaPM1NDym8yrA7sDqV5iPW FwjWE5AXVOY96r7uZiBk2d++9CiPErENN8vW7L7HEb9z30mUzpJ4lgSaBoj5Kb0a5g1u KxccvAuu0IsMCrV55yKKERr53DTtwpTgijWlFx/ViRu+WKjMyjgJMTrtRYOCrqVDRRxT ORew== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: airlied@linux.ie, nirmoy.das@amd.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In amdgpu_bo_list_ioctl when idr_alloc fails don't return without freeing bo list entry. Fixes: 964d0fbf6301d ("drm/amdgpu: Allow to create BO lists in CS ioctl v3") Signed-off-by: Nirmoy Das --- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c index 7bcf86c61999..c3e5ea544857 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c @@ -284,7 +284,7 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data, mutex_unlock(&fpriv->bo_list_lock); if (r < 0) { amdgpu_bo_list_put(list); - return r; + goto error_free; } handle = r;