From patchwork Wed Apr 4 22:59:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sripada, Radhakrishna" X-Patchwork-Id: 10323559 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 0357560318 for ; Wed, 4 Apr 2018 22:58:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E892D28E1A for ; Wed, 4 Apr 2018 22:58:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC1F828E55; Wed, 4 Apr 2018 22:58:06 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED 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 7789528E1A for ; Wed, 4 Apr 2018 22:58:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4B4816E65B; Wed, 4 Apr 2018 22:58:05 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id 48AF06E65B for ; Wed, 4 Apr 2018 22:58:04 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Apr 2018 15:58:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,408,1517904000"; d="scan'208";a="31647925" Received: from invictus.jf.intel.com ([10.54.75.152]) by orsmga006.jf.intel.com with ESMTP; 04 Apr 2018 15:58:03 -0700 From: Radhakrishna Sripada To: intel-gfx@lists.freedesktop.org Date: Wed, 4 Apr 2018 15:59:57 -0700 Message-Id: <20180404225957.7457-1-radhakrishna.sripada@intel.com> X-Mailer: git-send-email 2.9.3 Subject: [Intel-gfx] [PATCH v2] drm/i915: Fix memory leak in intel_hdcp auth X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Static code analysis tool reported memory leak in intel_hdcp_auth_downstream. Fixing the memory leak. v2: Rebase, move free to a cleanup label(Jani) Cc: Jani Nikula Cc: Anusha Srivatsa Signed-off-by: Radhakrishna Sripada Reviewed-by: Anusha Srivatsa --- drivers/gpu/drm/i915/intel_hdcp.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c index 98a9c81e2dc1..2db5da550a1c 100644 --- a/drivers/gpu/drm/i915/intel_hdcp.c +++ b/drivers/gpu/drm/i915/intel_hdcp.c @@ -435,7 +435,7 @@ int intel_hdcp_auth_downstream(struct intel_digital_port *intel_dig_port, ret = shim->read_ksv_fifo(intel_dig_port, num_downstream, ksv_fifo); if (ret) - return ret; + goto err; /* * When V prime mismatches, DP Spec mandates re-read of @@ -451,12 +451,15 @@ int intel_hdcp_auth_downstream(struct intel_digital_port *intel_dig_port, if (i == tries) { DRM_ERROR("V Prime validation failed.(%d)\n", ret); - return ret; + goto err; } DRM_DEBUG_KMS("HDCP is enabled (%d downstream devices)\n", num_downstream); - return 0; + ret = 0; +err: + kfree(ksv_fifo); + return ret; } /* Implements Part 1 of the HDCP authorization procedure */