Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1824981imm; Mon, 3 Sep 2018 10:24:08 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbsQn50gShMCzNH3N0iuCJFyc8E9z9FZu7cCkftSbpbpnT9Dzhpo8S9PuPr7wYsCW7xxjcj X-Received: by 2002:a17:902:b282:: with SMTP id u2-v6mr24192125plr.123.1535995448455; Mon, 03 Sep 2018 10:24:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995448; cv=none; d=google.com; s=arc-20160816; b=iE9gGOZgSia9Jl4odq7B2OwqhSqjlJjltVZL3L0QKQIgSG/YbRQkfrqPVzq5qEklkR dJtltVwIajHozGq+R/KLMyiVFYWZYHNtMlDA36z8mtKYlYMwo7SmqdAEquya4IBoqZfk jgNpgimkfkewO1Uk+VvSBQbv0bJsZA32g7oEB067px9ENaei/oGskZ81jY+zSmiy0r2q VuTbIvWYfxM+fSRA4jq4amuYYKNrl0VipcGahX8E3JrB/1SCfx7iIIF0VQW5wixC8n5N jRNwNw7F9qpj0DduY5C4YtXEifX/Rya/YGOJCEuJKZC/wpXof/vahuk5GDKcfBYUJLGA wfRQ== 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=G50/DDPSD1e3Jhrc7kecK6p1nUsNu+qpuBursKIXEtM=; b=n2/w8YHmRLHTSJys6l2ppD+ROtre5cklR0tzubk58C2Aao2wqBwA5CRkU0GoREH9o0 XIulu7UTJck6LWvteCqIvxp+0l1gA8hboZmPBHU689xXiSqR1bUHbm+WAHZGMb+FyBgR o08yudafxvN8rlGzZUE0VGT/E5E12VB7H5v46ujEeyb8XZtw9WdnVZLu/VVNLUyq340K qMvkZLqHVxEkxkxkTgE9LMyWkD3z5cB4qTqwj5NsCoht5ViwUhNYZ7JfMNu4Xf4RslC9 oT8mqO2igez/AY+JmiuBGmWCeQ4JYzFrMjQ5ITFf/mO4Kgfx2C1FN8G0lfIkPhS2RzB1 mlXQ== 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 s61-v6si17805160plb.125.2018.09.03.10.23.53; Mon, 03 Sep 2018 10:24:08 -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 S1728622AbeICVnA (ORCPT + 99 others); Mon, 3 Sep 2018 17:43:00 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43290 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727873AbeICVm7 (ORCPT ); Mon, 3 Sep 2018 17:42:59 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 280EED29; Mon, 3 Sep 2018 17:21:52 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Thumshirn , ard , Hannes Reinecke , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.14 080/165] scsi: fcoe: clear FC_RP_STARTED flags when receiving a LOGO Date: Mon, 3 Sep 2018 18:56:06 +0200 Message-Id: <20180903165659.096147070@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@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: Johannes Thumshirn [ Upstream commit 1550ec458e0cf1a40a170ab1f4c46e3f52860f65 ] When receiving a LOGO request we forget to clear the FC_RP_STARTED flag before starting the rport delete routine. As the started flag was not cleared, we're not deleting the rport but waiting for a restart and thus are keeping the reference count of the rdata object at 1. This leads to the following kmemleak report: unreferenced object 0xffff88006542aa00 (size 512): comm "kworker/0:2", pid 24, jiffies 4294899222 (age 226.880s) hex dump (first 32 bytes): 68 96 fe 65 00 88 ff ff 00 00 00 00 00 00 00 00 h..e............ 01 00 00 00 08 00 00 00 02 c5 45 24 ac b8 00 10 ..........E$.... backtrace: [<(____ptrval____)>] fcoe_ctlr_vn_add.isra.5+0x7f/0x770 [libfcoe] [<(____ptrval____)>] fcoe_ctlr_vn_recv+0x12af/0x27f0 [libfcoe] [<(____ptrval____)>] fcoe_ctlr_recv_work+0xd01/0x32f0 [libfcoe] [<(____ptrval____)>] process_one_work+0x7ff/0x1420 [<(____ptrval____)>] worker_thread+0x87/0xef0 [<(____ptrval____)>] kthread+0x2db/0x390 [<(____ptrval____)>] ret_from_fork+0x35/0x40 [<(____ptrval____)>] 0xffffffffffffffff Signed-off-by: Johannes Thumshirn Reported-by: ard Reviewed-by: Hannes Reinecke Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/libfc/fc_rport.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/scsi/libfc/fc_rport.c +++ b/drivers/scsi/libfc/fc_rport.c @@ -2164,6 +2164,7 @@ static void fc_rport_recv_logo_req(struc FC_RPORT_DBG(rdata, "Received LOGO request while in state %s\n", fc_rport_state(rdata)); + rdata->flags &= ~FC_RP_STARTED; fc_rport_enter_delete(rdata, RPORT_EV_STOP); mutex_unlock(&rdata->rp_mutex); kref_put(&rdata->kref, fc_rport_destroy);