From patchwork Fri Jan 8 00:40:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: KY Srinivasan X-Patchwork-Id: 7980331 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 25C08BEEE5 for ; Thu, 7 Jan 2016 23:05:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6099620149 for ; Thu, 7 Jan 2016 23:05:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8E6282013D for ; Thu, 7 Jan 2016 23:05:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753786AbcAGXFn (ORCPT ); Thu, 7 Jan 2016 18:05:43 -0500 Received: from p3plsmtps2ded04.prod.phx3.secureserver.net ([208.109.80.198]:38929 "EHLO p3plsmtps2ded04.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753723AbcAGXFm (ORCPT ); Thu, 7 Jan 2016 18:05:42 -0500 Received: from linuxonhyperv.com ([72.167.245.219]) by : HOSTING RELAY : with SMTP id HJchanTRHWOsdHJchadLai; Thu, 07 Jan 2016 16:05:41 -0700 x-originating-ip: 72.167.245.219 Received: by linuxonhyperv.com (Postfix, from userid 507) id DF8F8190337; Thu, 7 Jan 2016 16:40:48 -0800 (PST) From: "K. Y. Srinivasan" To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, ohering@suse.com, jbottomley@parallels.com, hch@infradead.org, linux-scsi@vger.kernel.org, apw@canonical.com, vkuznets@redhat.com, jasowang@redhat.com, martin.petersen@oracle.com, hare@suse.de Cc: "K. Y. Srinivasan" , Subject: [PATCH 1/1] scsi: scsi_transport_fc: Fix a bug in the error handling function Date: Thu, 7 Jan 2016 16:40:45 -0800 Message-Id: <1452213645-18889-1-git-send-email-kys@microsoft.com> X-Mailer: git-send-email 1.7.4.1 X-CMAE-Envelope: MS4wfFk9/BwejnCzHAYexnfwcwSlWxI6Zq4XrvTFST+clbUPRUyKChVbYRXiKjcN/avC+8KK8nLH3fy7ybdxJG8QJoYUlW7e8ylwY/8uRANFLP7EKarcwdmf 10p+C4LZDEFEUGN77OzHWAwzOJm3hDtHbJO8/NRO1YMqp6IHqiJaHfn1tuHi2ocMod0FI5ZeQe7jHYCRbT0VWhL6p7QhkrhgWwwu8d18fTrH7NZaSfXaxSRy A37xN6/tu16d1jlugFSnS7OMR5CkTBipv2YM6+7zlxSUAxB96mGdw6xnP/5dJXDiUVHCLD/hHspY3alwFCFk8tYAxNavvjDeqAWBODvhVIE5u4PBwtM+ryiH 1Sqg0wS64+Ak9MNERev9BaHjWdhAXgQE+w1BeGOLnaK+X4wpjlv+z6G/P8r2gGHLQcyoVC704xNehPSmDVNovdl4Ysu048thRpsOXdFOUSFDNsypY5DJaeJz wxDttwhMAN1Ee85K178/IAc/GH7Zdz65CecUiR5ZUXJRCYj384vnir0S8UUs8Vob0lwLyJ+06mceGEB8TIkrWJ6WForVtIGaeDlJ1xk1MhlvXlh1dgLRakOk N/o6UNAI3AoNuhUsTcRY/0kG Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The macro startget_to_rport() can return NULL; handle that case properly. Signed-off-by: K. Y. Srinivasan Cc: --- drivers/scsi/scsi_transport_fc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 24eaaf6..42a908f 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -2081,7 +2081,7 @@ fc_timed_out(struct scsi_cmnd *scmd) { struct fc_rport *rport = starget_to_rport(scsi_target(scmd->device)); - if (rport->port_state == FC_PORTSTATE_BLOCKED) + if ((rport == NULL) || (rport->port_state == FC_PORTSTATE_BLOCKED)) return BLK_EH_RESET_TIMER; return BLK_EH_NOT_HANDLED;