Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp850836ybi; Fri, 12 Jul 2019 05:42:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJmOL33XcBmDgK20Lkh6jeX8/sdcOf9Fu8u5NO8K8UFiCGBcvtAUCGrhjYRTl1jdL8Vyr2 X-Received: by 2002:a17:902:27a8:: with SMTP id d37mr11288782plb.150.1562935322810; Fri, 12 Jul 2019 05:42:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562935322; cv=none; d=google.com; s=arc-20160816; b=pCBA6yja1qt7qI9yrBXEDnl/dQV+bHtEhjREhdyYu0HpYxswb/3jmyeV1MPvcpbpMT 76+fk3kU1HeZZYC+GXiVeEEitV0iL2M6hwKvVlf8q2REDRFmoXRvho5MJ2tiSiWrcxcg XoZ6/gu2eUM9oHB6jpwWpxOg/ChKzT1XU0eto8KrvJWLirSfn9pliZ7Rr3OBvQMjp1yA ioRYiZh0t1QG0pZ8DTXGOIkxcUy1JK2rcbdFawJIvP9gFs7XoAbisCbb2lL1Q95N1owo +PYIv+jC5ME23/eyvTnXL8sGjIeVrf/EZt6FsLyTQVFwaN3te/gcuPjY5kx43NK8+moW L8NA== 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=74N5NgAoas0WUZAOxcrLijzCOFudb176ZSHpDF3Lc3g=; b=YFhovirP0dJdor3zGMnRLxfuMbgW2oquAauzcppf2RmaCrUtO3wG55pCKSVdy3Czuc mOjgoebqC2bIyuq6BPbfRYQNXJlswgsA6p/FKW+mVYtfLYvaK9unoJSBu+cp5ktuwe2b /WkHPq/MWOeYitsa6dcloe8PgNR0Lh+jy/bTNL6gBpJoJrkIgKa70eQD0I2AemHOHY+H PMayTGX0Pw8yG+y4XB9307Zht0PerlvBd7kbI5KQSGOJDfeYgBY9mVCrTkrx69eiE9on GOtebiZFtbS3kbAIjwBNI9WZd9ANtHN1pf1snTg9pRGpwbSvfNQBd2fo66DU7VfNG70G LCoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=u6AzJRL4; 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 l64si8052630pjb.93.2019.07.12.05.41.47; Fri, 12 Jul 2019 05:42:02 -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=u6AzJRL4; 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 S1728165AbfGLMYr (ORCPT + 99 others); Fri, 12 Jul 2019 08:24:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:33566 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727395AbfGLMYl (ORCPT ); Fri, 12 Jul 2019 08:24:41 -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 AEBF621019; Fri, 12 Jul 2019 12:24:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934280; bh=Fir5gD7HoVSspzZZj/q0JYDTXCfrEIHVt0flZ8zV70A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u6AzJRL49O+rxvhBxli/9wURGyxtmM9oubUogdYCziNDUpIR2PcTtNn6pBug982lb CjEEPnkvxLeK4iCBK3ylceE8IXuZTM+UpBwEzlJWAh6BbkIOmwLMPGdHEfVuqCjmRh db4VOvq5TNVZIQN1vM8uC+31hNjMIxDhUM5dq/ks= 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 4.19 51/91] scsi: qedi: Check targetname while finding boot target information Date: Fri, 12 Jul 2019 14:18:54 +0200 Message-Id: <20190712121624.401088432@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121621.422224300@linuxfoundation.org> References: <20190712121621.422224300@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 4de740da547b..763c7628356b 100644 --- a/drivers/scsi/qedi/qedi_main.c +++ b/drivers/scsi/qedi/qedi_main.c @@ -955,6 +955,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