From patchwork Tue Mar 5 10:58:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839279 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C08E91803 for ; Tue, 5 Mar 2019 10:59:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD5562B2C2 for ; Tue, 5 Mar 2019 10:59:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A1FAE2B360; Tue, 5 Mar 2019 10:59:40 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 959DA2B2C2 for ; Tue, 5 Mar 2019 10:59:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727483AbfCEK7j (ORCPT ); Tue, 5 Mar 2019 05:59:39 -0500 Received: from mail-eopbgr770075.outbound.protection.outlook.com ([40.107.77.75]:9148 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727477AbfCEK7j (ORCPT ); Tue, 5 Mar 2019 05:59:39 -0500 Received: from BYAPR07CA0007.namprd07.prod.outlook.com (2603:10b6:a02:bc::20) by BN7PR07MB4756.namprd07.prod.outlook.com (2603:10b6:406:f0::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Tue, 5 Mar 2019 10:59:37 +0000 Received: from BY2NAM05FT031.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::204) by BYAPR07CA0007.outlook.office365.com (2603:10b6:a02:bc::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1686.16 via Frontend Transport; Tue, 5 Mar 2019 10:59:37 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT031.mail.protection.outlook.com (10.152.100.168) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 10:59:36 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 02:59:33 -0800 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x25AxXqJ013264; Tue, 5 Mar 2019 02:59:33 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25AxXmN013263; Tue, 5 Mar 2019 02:59:33 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 11/26] qedf: missing kref_put in qedf_xmit() Date: Tue, 5 Mar 2019 02:58:46 -0800 Message-ID: <20190305105901.13185-12-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962571770262459;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(346002)(39860400002)(396003)(376002)(136003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(69596002)(126002)(26005)(6862004)(305945005)(97736004)(2351001)(26826003)(80596001)(4326008)(53936002)(50466002)(16586007)(68736007)(316002)(54906003)(47776003)(76176011)(42186006)(85426001)(36906005)(48376002)(356004)(81166006)(6666004)(476003)(2616005)(14444005)(1076003)(8676002)(4744005)(8936002)(81156014)(86362001)(5660300002)(106466001)(105606002)(11346002)(50226002)(336012)(36756003)(87636003)(51416003)(486006)(498600001)(2906002)(446003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN7PR07MB4756;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 666bc34b-8e3e-4c47-2578-08d6a159a87a X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BN7PR07MB4756; X-MS-TrafficTypeDiagnostic: BN7PR07MB4756: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;BN7PR07MB4756;23:yq+qNBOmZ0niVflSfCFjdefERBVc6K3TfaGMykXqXcumXzinhB0lB6uidZSYevIpUGJSA6kIz8Wm5nDEFLxPGFzmBaqh4MXZ3gDXVp7ecD+xSlC+RbUuj1pk8k0VrATpeGEHoO2U1JMqDFmVQSjQwBKTKx6Zty+/HPWADYrSgud2gFSjTjNXEmxfgl2O5+8kxZagXe/ziBN2OVEgcwGU5YB+GUZv42k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pan6gljqLWYtLQ== X-Microsoft-Antispam-Message-Info: z3GN05vV8oERglX4Q11qMVML+k0qulsRCd3mgl9EOTEQ9979R5Od2eRLxpHzQ9EjxO+TI2xWlF0PrhTkY4N+86od6NFvwobgoavA0ngRg/ANQ5Qcv7qRYO4UW46NkEUrcxRu7GRYa1AXLEc29SSA57Fg3Z9ybbb77UIJ1EwZbrpdsfg+Dfxu20du6N2dipxVgCjma+ub2vRM4mm+3P7BSposbUYh7r81n5FpMIV1Skh+t7kOvoUPSCdMDaOpvxK1F0160XOxFwYUaejZj0B8dU+xtg/aDeozkFRndBOTwMARHW0ChbcL0ApdyDW1DQrx5ONl8B3ZJxTn6STmeeYmTFqU01Tg+ejDPwJl41ylsF6s4w+QPKmgT7a+BijcJqprYjmXIYffOPhHPtvqEXhlEcNXg83A/7/pk3y4us9Dn3c= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 10:59:36.7740 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 666bc34b-8e3e-4c47-2578-08d6a159a87a X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR07MB4756 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hannes Reinecke qedf_xmit() calls fc_rport_lookup(), but discards the returned rdata structure almost immediately without decreasing the refcount. This leads to a refcount leak and the rdata never to be freed. Signed-off-by: Hannes Reinecke Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index f84552e..fb9c288 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -971,8 +971,10 @@ static int qedf_xmit(struct fc_lport *lport, struct fc_frame *fp) "Dropping FCoE frame to %06x.\n", ntoh24(fh->fh_d_id)); kfree_skb(skb); rdata = fc_rport_lookup(lport, ntoh24(fh->fh_d_id)); - if (rdata) + if (rdata) { rdata->retries = lport->max_rport_retry_count; + kref_put(&rdata->kref, fc_rport_destroy); + } return -EINVAL; } /* End NPIV filtering */