Received: by 10.213.65.68 with SMTP id h4csp505302imn; Fri, 16 Mar 2018 09:47:39 -0700 (PDT) X-Google-Smtp-Source: AG47ELunLKwQSADQwp8i7MuJcJkMC4r5VHnLGQz0h+y5xes7tLCP2xczdztUUxLDe39xIxs/kLDN X-Received: by 2002:a17:902:5852:: with SMTP id f18-v6mr2764896plj.289.1521218859480; Fri, 16 Mar 2018 09:47:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521218859; cv=none; d=google.com; s=arc-20160816; b=rfYdl2z/FGBkXYzoqDLwqPLFuxOLBx7BRx15bz7FpSwEDlZqoDU7+uXORpwwYMFSAR DF4zNN35iOYKSwnleePKjVpqk9SjfxJliQvRuHz6cvo+ymvzs/azj42FdSzQUSuRsUiV 4RxSgCFYdRQs0oOYnyS5nmQ5PAgmH8sd9FHE84SYIfv6DY4VrEdAhMFke3YWsnYAD2Y2 Qnu39tNXVI3XpPoS5GA6LWwfNaijxJ8CqCK6kRD+FiWQLCLpaNcU2yHGn/Z3ZUEC2xu0 S2IAqIhWW/XJe4S2Tl2ZiaRl77JKNdtPwvFQtGN6zFY+I+KZAV/7MHmFSxSiYzCw0gcp hYvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=+4BwCB/h9AJ/hJt0PmQhwKGCIovR/ubPNIyOrPJb02k=; b=Igz84ajaMI1WHECyFjelQ1AyVWkSVjz6aMFY5+qQUs4nfRiO/N3YSQKAlWUMOBmAu+ MzfR9loqC8w+PAxWwcIMYYJInxpBZN1SgKxs0icsKIQEDEzcc9yCnnYjztc/wfQm3MMd Wj/ePTmrGvrG8aF+lbd8/GBifTXX2d6jY7X/IgxjcaO7z1aM9crUEywRAbkx3v8ANz2V gn7OshcYX8UJdWVVXTp/puGdr5o9FXvGh/iJk8SY9IjliLgFC1Qq+T9qKIyXTOzR3qpl w9wndktOxoJQTwkjvpA2Sa9ZW45ItJvphpKoFI+pr7pq1to8hMTq9iYWK/vibUnTY0K9 28xQ== ARC-Authentication-Results: i=1; mx.google.com; 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 y19si5103463pgv.139.2018.03.16.09.47.25; Fri, 16 Mar 2018 09:47:39 -0700 (PDT) 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; 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 S934186AbeCPPfo (ORCPT + 99 others); Fri, 16 Mar 2018 11:35:44 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:39926 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933697AbeCPPfj (ORCPT ); Fri, 16 Mar 2018 11:35:39 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 0DA8C109C; Fri, 16 Mar 2018 15:35:38 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Herbert Xu , Sasha Levin Subject: [PATCH 4.14 043/109] crypto: cavium - fix memory leak on info Date: Fri, 16 Mar 2018 16:23:12 +0100 Message-Id: <20180316152332.314598267@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152329.844663293@linuxfoundation.org> References: <20180316152329.844663293@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Colin Ian King [ Upstream commit 87aae50af730a28dc1d8846d86dca5e9aa724a9f ] The object info is being leaked on an error return path, fix this by setting ret to -ENOMEM and exiting via the request_cleanup path that will free info. Detected by CoverityScan, CID#1408439 ("Resource Leak") Fixes: c694b233295b ("crypto: cavium - Add the Virtual Function driver for CPT") Signed-off-by: Colin Ian King Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/cavium/cpt/cptvf_reqmanager.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/crypto/cavium/cpt/cptvf_reqmanager.c +++ b/drivers/crypto/cavium/cpt/cptvf_reqmanager.c @@ -459,7 +459,8 @@ int process_request(struct cpt_vf *cptvf info->completion_addr = kzalloc(sizeof(union cpt_res_s), GFP_KERNEL); if (unlikely(!info->completion_addr)) { dev_err(&pdev->dev, "Unable to allocate memory for completion_addr\n"); - return -ENOMEM; + ret = -ENOMEM; + goto request_cleanup; } result = (union cpt_res_s *)info->completion_addr;