Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1115224imm; Wed, 1 Aug 2018 10:25:46 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdY/yOONYs7UTIyvbdSPtBcRHVp+nYaSLowYXKjOd4EMPhLnA8nJO1+ihXdcLRmA3xgBrG2 X-Received: by 2002:a62:4083:: with SMTP id f3-v6mr27663730pfd.229.1533144346173; Wed, 01 Aug 2018 10:25:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533144346; cv=none; d=google.com; s=arc-20160816; b=IBAPiNnwPCMJkecj/ahD4VtDwUr+JYekUWbTXsy75gGHIDnbK8r815kqGMDjvwGDhO EKXn4a7+Nz8YG/Pk6rQW1LNa4U5AR/Lf0hOnxPSnwhsdbq2L6ib1bq7c8vlCTT30Y32f /Mr6xC4ym0gefigVB5+jiaKw/+3RMTDbadYGmGy0tcqsABlK8YKs5UvoWrF0Alby19ij pCy0960BW/FbOoOLr1oGnTgj51vcryR8CRkyeHXhWXu0924g51nc8HuCPnLTPmrcOuEu nHH4YwzVEzxGqmEHe2Xx352K+/r3SDbOm/UbZOx7dC1c6zXXksndmDJcYxzVXW+KI9IV a4zA== 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=/ZiXvzJeGnDVhvgWlQAphIGOfWgOV/1Gx+PZkW/aK2o=; b=uGTlgD2wcmbM2r/BYKlcb26pNbVIvL1GV6He6/gi/MENG+zC/nQLt+0CjGpMEiklfC wNflMQINDlcZAuVElSHhuPWngAAFc5QOodwonxiDGNOtLBF/NLut/LuNiEuO8e4sCmmz P42Fj8sPva6Qexaiou8F6gyI/Y9h86+NNndd3w6HSUV4VWbbXACWQa+CgYzTw1LBNh02 wVUH3GY4g9PeClw5dD8QfLRaW7M6berairCOi0J5cCJm0rFLvD9Q18ZO4HbfCfXIV++U gP73Ts08ZonrcwsVGcQzDh2tu9ViOveAcu/NMd9m7On57gdbEa2Pxza1lVjyLRE064iN slTA== 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 v16-v6si16586929pgb.96.2018.08.01.10.25.31; Wed, 01 Aug 2018 10:25:46 -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 S2390426AbeHATKS (ORCPT + 99 others); Wed, 1 Aug 2018 15:10:18 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50972 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389790AbeHATKS (ORCPT ); Wed, 1 Aug 2018 15:10:18 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 21CE3D27; Wed, 1 Aug 2018 17:23:35 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, NeilBrown , James Simmons , Sasha Levin Subject: [PATCH 4.14 195/246] staging: lustre: ldlm: free resource when ldlm_lock_create() fails. Date: Wed, 1 Aug 2018 18:51:45 +0200 Message-Id: <20180801165021.062796428@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@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: NeilBrown [ Upstream commit d8caf662b4aeeb2ac83ac0b22e40db88e9360c77 ] ldlm_lock_create() gets a resource, but don't put it on all failure paths. It should. Signed-off-by: NeilBrown Reviewed-by: James Simmons Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -1571,8 +1571,10 @@ struct ldlm_lock *ldlm_lock_create(struc return ERR_CAST(res); lock = ldlm_lock_new(res); - if (!lock) + if (!lock) { + ldlm_resource_putref(res); return ERR_PTR(-ENOMEM); + } lock->l_req_mode = mode; lock->l_ast_data = data; @@ -1615,6 +1617,8 @@ out: return ERR_PTR(rc); } + + /** * Enqueue (request) a lock. * On the client this is called from ldlm_cli_enqueue_fini