Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp81467ybm; Tue, 26 May 2020 11:16:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzN+PGak0hLeWfsyheQEC0zq71IWFeWcxfhXV5q3i59tH6gLexK6k1ySflJOSHSwSBhYXkI X-Received: by 2002:a17:906:63c9:: with SMTP id u9mr2351989ejk.487.1590517003966; Tue, 26 May 2020 11:16:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590517003; cv=none; d=google.com; s=arc-20160816; b=lCPTo++/I8A9C/kk42PqVjz4xP9reJDFnbHXdFaPx515J8Lbb0O9UXL95sSyncEPDE 6gXzSBZCSw1JD4gok4Rt11K1k8Ct5smeZPWbHzNgA4vb1Uz+WrJkAiaTWiiJOoyhK5BR rvLNyNlzy4gLD6+P+GR9dqMmq9LI6oVL3JwuQse1bEjpowW197sUtqCjYbEhp5uP/h29 QwIYJcF9FOTjs6AD0bSbHLVZg6usFd27eQlLfRKqjUcwd/HRHUefw2k14ojzpRoOP8mr 3A+F48FUlRFbsht1MNBcZ5ZWT5Z1GZmPadgDqdwAM4BcS0dQDWaRKEtR6QuyuDGvhxFJ QnAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=XMJPsfrPwL4udIgNX9sd/5hcecE1GbPrvJExtmMB778=; b=bokS16nkPSRVE1ZGygAYf4sZe6i7q0PzPZNEzd0Suvlsz1VhnhHDbIw2h1VFP3zLaN DH9BV1SwcBWff1mYbKS4DklKuDStv8/BmcBx/pUa1DvV7vYVgcD2oRCldh1bgkUXH77y wfRi6vlX38uRy+Qiy/luLzznsQF3W1LvJkXnEbVxxp67fGiUNwc9DTTpdv+kbb7N+vtS kKf2zsG49oV4iltz90U+iOEf6l91s23aZMnFiYW2yTxT4K1U9cf6SvAbb4at8sPxzGAs 81WxaPP4GqD/Ik9qCY+oQbWPtN63SYgfgRL3hAhtjyEW8fOuhTeEKg86OOja6+8P1Cw+ 1p3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=XLbEotUG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qt28si354229ejb.256.2020.05.26.11.16.20; Tue, 26 May 2020 11:16:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=XLbEotUG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728685AbgEZSL5 (ORCPT + 99 others); Tue, 26 May 2020 14:11:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727112AbgEZSL5 (ORCPT ); Tue, 26 May 2020 14:11:57 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22299C03E96D for ; Tue, 26 May 2020 11:11:57 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id n15so122933pjt.4 for ; Tue, 26 May 2020 11:11:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=XMJPsfrPwL4udIgNX9sd/5hcecE1GbPrvJExtmMB778=; b=XLbEotUGWPUSVr5vWk2fim05qClEhsltJrxucG9Q/iXw8jS8O4OQ0wf9/JhaHbIliE O8zjHXdJzq1/lwIkYGys9V9WFGRWmxNWn7wkzpEud3rHX7z5L7E6Ue3jLCWmwc0A/0p9 Kjem93QOZwvmI9fwvMtlLeHTQeKd4jUaSB26Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=XMJPsfrPwL4udIgNX9sd/5hcecE1GbPrvJExtmMB778=; b=qrwOrEYnA3AgmotM+JFyLuhE0j0lCEZK/MGulhA3C8PTxAMEQjcxryoc2e48fpMjXj aeQkL1bjgsShrt37JScjQF7zoa4uI43s7q5joo2yJGs/vxB3yeh+03tD6pdUyvkwkuR4 KEfCbP4IwUcmLDic5PhUWMa4jTrMd7Hvd7FEuADTQCSdg1FnCDdYe4VLhIz/8TzYRlRg GNOZvUF2KJffU4rO0v41sxF3FtUmWaYiQ95dhp4/S2rSfKYkebD0p1jYWwNP3US7L+za hnPdCS4R8KpgfabI0DOcqAulKKtSZBsVsn5wvhlIa4krcLcG/qGJ3X6Nqh5kULmoeIR1 tV0g== X-Gm-Message-State: AOAM531e9VoQl9DquyWNFb1I7rmaVQcR6xBQZ5d0xnQU16XKLEyrvS3l r+1BpOQYesvfDkNR0/xTCNSyAw== X-Received: by 2002:a17:90a:fe97:: with SMTP id co23mr498961pjb.96.1590516716568; Tue, 26 May 2020 11:11:56 -0700 (PDT) Received: from [10.230.185.151] ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id y138sm214647pfb.33.2020.05.26.11.11.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 26 May 2020 11:11:55 -0700 (PDT) Subject: Re: [PATCH] scsi: lpfc: Fix lpfc_nodelist leak when processing unsolicited event To: Daniel Wagner , Xiyu Yang Cc: Dick Kennedy , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, yuanxzhang@fudan.edu.cn, kjlu@umn.edu, Xin Tan References: <1590416184-52592-1-git-send-email-xiyuyang19@fudan.edu.cn> <20200525151220.rtwmlobnkmhwhxn5@beryllium.lan> From: James Smart Message-ID: Date: Tue, 26 May 2020 11:11:53 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200525151220.rtwmlobnkmhwhxn5@beryllium.lan> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/25/2020 8:12 AM, Daniel Wagner wrote: > Hi, > > On Mon, May 25, 2020 at 10:16:24PM +0800, Xiyu Yang wrote: >> In order to create or activate a new node, lpfc_els_unsol_buffer() >> invokes lpfc_nlp_init() or lpfc_enable_node() or lpfc_nlp_get(), all of >> them will return a reference of the specified lpfc_nodelist object to >> "ndlp" with increased refcnt. > lpfc_enable_node() is not changing the refcnt. > >> When lpfc_els_unsol_buffer() returns, local variable "ndlp" becomes >> invalid, so the refcount should be decreased to keep refcount balanced. >> >> The reference counting issue happens in one exception handling path of >> lpfc_els_unsol_buffer(). When "ndlp" in DEV_LOSS, the function forgets >> to decrease the refcnt increased by lpfc_nlp_init() or >> lpfc_enable_node() or lpfc_nlp_get(), causing a refcnt leak. >> >> Fix this issue by calling lpfc_nlp_put() when "ndlp" in DEV_LOSS. > This sounds reasonable. At least the lpfc_nlp_init() and lpfc_nlp_get() case > needs this. And I suppose this is also ok for the lfpc_enable_node(). > > Reviewed-by: Daniel Wagner > > Thanks, > Daniel Looked at it here and it looks good. Reviewed-by: James Smart -- james