Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5177265imm; Tue, 31 Jul 2018 06:49:36 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcU/oe8SlYxGsmYmGVznp+C8eOiwnrOqBJEHK/NBuqkxhdvUV8vk87wPRe8kv8QxvZRDbl9 X-Received: by 2002:a17:902:b40c:: with SMTP id x12-v6mr20868257plr.163.1533044976621; Tue, 31 Jul 2018 06:49:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533044976; cv=none; d=google.com; s=arc-20160816; b=XXaMPCfu23FJSh9jm56/ymLP8Jg4sa+RgYwKgvnkaGEEAAYjFwBTmm963RGmBbf0kp f+KCp9TcxONiYjcVDzfTzyuWyNieUjPIzP4vTusr//0gTHa8Bu3S0or3LpKAzpGlFIMT ConK4g4ori2HF98UDDx+j9D22i+nldzz7HXY6s3Ovv+onxSgMp95AzKHU4IXJglBX7nt 1n+WYTmB+B3ZY79sbY+23emQAc6zQJjyCgpiv4mWpxHjkMnoS+AGoVt/jyfZFVZ9XXwx a8mRP/hWdEQyfXO6oPQfZRQ81KI0ts4aIQprYvTxYM/Ydd6sLIlKlRL4lm9Wjjtffr7V 4mpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=mLj2rMNYCEVOgVw1wENMBS7aZrEUc++sCx0PTxPtqUo=; b=dLPcnHjxSBwEeAxuoND7fVHOmFMKJJmnGW8S5zXCIW89joNp1nhAVBcbFbrP9p1DCG 1KwwM0yagfbs7trBGzI9TtB003mVDv39WTine9eQcIM4H0nclyLb6jJacK1PiGonxxrh FevmTiViyUaPqowcXBU8VZkC+ZegGow4zbxbBzX/yO0YdRMp1ueNSXj5HAUUFWdcTljP SGINsDwCuv8VwmjKrMM6zU+FvEZpZQhPsW5tyHgN7QVZy8fxUxK6MSggbHMCKVLs1nO8 PYBz4tKMxkZlw3pZsdBQ9502kbrtwLggNYF0vMsHzrgC1odDrbi2ptjLJgRbY4q3qv6p /oXQ== 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 d11-v6si12820200pgm.556.2018.07.31.06.49.22; Tue, 31 Jul 2018 06:49:36 -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 S1732418AbeGaP2l (ORCPT + 99 others); Tue, 31 Jul 2018 11:28:41 -0400 Received: from mx2.suse.de ([195.135.220.15]:41920 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732380AbeGaP2h (ORCPT ); Tue, 31 Jul 2018 11:28:37 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 31D5CAE4D; Tue, 31 Jul 2018 13:48:12 +0000 (UTC) From: Johannes Thumshirn To: "Martin K . Petersen" Cc: Linux Kernel Mailinglist , Linux SCSI Mailinglist , ard , Johannes Thumshirn Subject: [PATCH 3/3] scsi: fcoe: clear FC_RP_STARTED flags when receiving a LOGO Date: Tue, 31 Jul 2018 15:46:03 +0200 Message-Id: <20180731134603.20089-4-jthumshirn@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180731134603.20089-1-jthumshirn@suse.de> References: <20180731134603.20089-1-jthumshirn@suse.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/scsi/libfc/fc_rport.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c index 31d31aad3de1..89b1f1af2fd4 100644 --- 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(struct fc_lport *lport, struct fc_frame *fp) 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); -- 2.16.4