Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp847834ybi; Fri, 12 Jul 2019 05:38:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqx78j0Bcyw8WsNRznYIKKPRsIK7IvZSgekBUKK18iuWsrzgvpAug/f6QWHc+ajTM9spNgM+ X-Received: by 2002:a17:902:b789:: with SMTP id e9mr10952976pls.294.1562935133606; Fri, 12 Jul 2019 05:38:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562935133; cv=none; d=google.com; s=arc-20160816; b=QwaIGUkwoKzHQyilnQDIKV1+DF7Sy+P9PmV4NPJfHGUibdMnTkjACx+feFOXfyR4Xh To7KDg7ESPrrEj8CGgLhtqAyqOhm9ixhnMmFSbPlTlHAtyNoDCFAj542a+n8p5lnCh6K yP3VVyDKcytM8Mm4E3Q6XlEuwa+89oK7BUfHgt7azNu5BphX4XBYRPhsJD1gR2DmFJHb GBgt4mu418HdZ3nymT0sH91Xl9pPS0hj5DIg+NN7RtwOGBpVtWqrlFaPvWj7kndV6pys HISIHekiRaAE6d/Gz5oavG9HJov7xvaqdMOV9JgOJKftEXvdsuis/BcGHncU0k2CZt8S 76Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NmE/VmcdSn6Dxiaf2C3qGW7dQU5NXBsCUyiWwS/FJ00=; b=zgCPQIZNX2xDA3l532FIvCTUvX+hUW4QW+OORNxlnCQasP9vcSpF8nWdmjIoyEyInA zwcwx5ta1c/mlEF2oe5wzzGRWsGrxJK77FsXAFzhJb/QF3vHXYv6oY2/XvykkHETEDC3 6/HW0Qq7sqIuY8HKCgIQSVelR0zdhBunWKBJlCm4rHhnR2Z9DXm8BYtQi1w6hJejnbFY T/UPiA2jh9l/0VJPE5wl4KvB42dddQxUfzHz99yW6hCY9Lt2wvmMo94lpp0OiCZ2tNrC 3RoWlDg0FyN+oaNyNP6vg/N2WkNcx75Jw+vqH628uSdDJMhuTabiJxkixwqIz6Sk5caA +iSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bAG0V7b6; 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 bj12si7310633plb.378.2019.07.12.05.38.38; Fri, 12 Jul 2019 05:38:53 -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; dkim=pass header.i=@kernel.org header.s=default header.b=bAG0V7b6; 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 S1729264AbfGLMaz (ORCPT + 99 others); Fri, 12 Jul 2019 08:30:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:47002 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729254AbfGLMaw (ORCPT ); Fri, 12 Jul 2019 08:30:52 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 24F28208E4; Fri, 12 Jul 2019 12:30:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934651; bh=lzhyzfmwmUKawTmQ/mElfmssS/iFia+yCKcYouMRLtQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bAG0V7b6lutT+vTaGlbdrBWIBC5ry53DnW71EKIVCl1do2jOws3hS+HaDCR60LlKF p9j6BZmdvbqkOSaHNU/zd0NqXpaJQD8yI/rIPLLEUZ2RItBExaVjXtKPHx4AD9Ipfe QKvw8JGxaH0QdkW+Rwx/+vbjs9UJOGISN0TgQ3cw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nilesh Javali , Lee Duncan , Chris Leech , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.1 082/138] scsi: qedi: Check targetname while finding boot target information Date: Fri, 12 Jul 2019 14:19:06 +0200 Message-Id: <20190712121631.884352148@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121628.731888964@linuxfoundation.org> References: <20190712121628.731888964@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 1ac3549ed58cdfdaf43bbf31ac260e2381cc0dae ] The kernel panic was observed during iSCSI discovery via offload with below call trace, [ 2115.646901] BUG: unable to handle kernel NULL pointer dereference at (null) [ 2115.646909] IP: [] strncmp+0xc/0x60 [ 2115.646927] PGD 0 [ 2115.646932] Oops: 0000 [#1] SMP [ 2115.647107] CPU: 24 PID: 264 Comm: kworker/24:1 Kdump: loaded Tainted: G OE ------------ 3.10.0-957.el7.x86_64 #1 [ 2115.647133] Workqueue: slowpath-13:00. qed_slowpath_task [qed] [ 2115.647135] task: ffff8d66af80b0c0 ti: ffff8d66afb80000 task.ti: ffff8d66afb80000 [ 2115.647136] RIP: 0010:[] [] strncmp+0xc/0x60 [ 2115.647141] RSP: 0018:ffff8d66afb83c68 EFLAGS: 00010206 [ 2115.647143] RAX: 0000000000000001 RBX: 0000000000000007 RCX: 000000000000000a [ 2115.647144] RDX: 0000000000000100 RSI: 0000000000000000 RDI: ffff8d632b3ba040 [ 2115.647145] RBP: ffff8d66afb83c68 R08: 0000000000000000 R09: 000000000000ffff [ 2115.647147] R10: 0000000000000007 R11: 0000000000000800 R12: ffff8d66a30007a0 [ 2115.647148] R13: ffff8d66747a3c10 R14: ffff8d632b3ba000 R15: ffff8d66747a32f8 [ 2115.647149] FS: 0000000000000000(0000) GS:ffff8d66aff00000(0000) knlGS:0000000000000000 [ 2115.647151] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 2115.647152] CR2: 0000000000000000 CR3: 0000000509610000 CR4: 00000000007607e0 [ 2115.647153] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 2115.647154] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 2115.647155] PKRU: 00000000 [ 2115.647157] Call Trace: [ 2115.647165] [] qedi_get_protocol_tlv_data+0x2c5/0x510 [qedi] [ 2115.647184] [] ? qed_mfw_process_tlv_req+0x245/0xbe0 [qed] [ 2115.647195] [] qed_mfw_fill_tlv_data+0x4b/0xb0 [qed] [ 2115.647206] [] qed_mfw_process_tlv_req+0x261/0xbe0 [qed] [ 2115.647215] [] ? dequeue_task_fair+0x41e/0x660 [ 2115.647221] [] ? __switch_to+0xce/0x580 [ 2115.647230] [] qed_slowpath_task+0xa3/0x160 [qed] [ 2115.647278] RIP [] strncmp+0xc/0x60 Fix kernel panic by validating the session targetname before providing TLV data and confirming the presence of boot targets. Signed-off-by: Nilesh Javali Reviewed-by: Lee Duncan Reviewed-by: Chris Leech Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/qedi/qedi_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c index e5db9a9954dc..a6ff7be0210a 100644 --- a/drivers/scsi/qedi/qedi_main.c +++ b/drivers/scsi/qedi/qedi_main.c @@ -990,6 +990,9 @@ static int qedi_find_boot_info(struct qedi_ctx *qedi, if (!iscsi_is_session_online(cls_sess)) continue; + if (!sess->targetname) + continue; + if (pri_ctrl_flags) { if (!strcmp(pri_tgt->iscsi_name, sess->targetname) && !strcmp(pri_tgt->ip_addr, ep_ip_addr)) { -- 2.20.1