Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5994300pxb; Mon, 14 Feb 2022 12:38:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwZex7wXK47k1SFICFuamwg4Rr9TrMs4YYqYxcV9KuWUbM7wEHfQnH1/iEjl0QcuLglv9bN X-Received: by 2002:a17:902:d482:: with SMTP id c2mr598737plg.148.1644871124952; Mon, 14 Feb 2022 12:38:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644871124; cv=none; d=google.com; s=arc-20160816; b=0LD/70QX/InQBNo5jOO+TvRyHKtzuA4VYuFwFBkzjQuYxHeVDtSifznwUnCDp8JqHq AWXtHO+jjzKhBx4tCwn/bv26+23UnGU6wrBrjsRXGp+xYO302oSsAnHcp7gZBPyIgHXo CcokkrAjdl8ykDezQUdlRWPydVV9nGo+LU8UBh2u6dcvvDEquPRYPoiDvO1WwpQ0EGoN jhXwlaYvfA/OypEHd4fZjKJiKbPwQZN0VZX7wvXhx4XHh0uG4Qr9vVBO+L3CGoJVV1VL B+cW8oKtIFSG3TOgsdbFnyW6hdOhMzDUu3c5mOBGBpKJgUsOs9Ok3AKMXB2+nM250XVR 1ASw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UbQ+aqkzClD69j4nfCb/tBqXGHVR2nBHE/qVpF8cty0=; b=dKGP3ZV1vhaFSyy2unvuQ4580QOmUzfDb8M6sA71aqgNw7e5bFhbn7efxmC1WLkFhX 8KEWaCU4rQB57y6J77v0sI1DWOFmxIgaO5H9Ghcyc6pzWot2T8Ad+e0Uw8b02I9VHFv0 doM4qtrbdpBMIZvKkIBMqZSUjcxZu72GqORRc+DihUdV40w1PMsaM9TahorcA0V/pXDE A6/IVL4f31fIpIAbn1V50qksM0pnZr2U1gUvVx9Ov4nA5O88boq7EbbkGyi3D6fNZ9o7 7XtXs+WGVwTi6SAKRUWQ9rmvdEDK0JAYQtQnYCvfQhL7zmyk1Y7Q6F3N8HrkdTEmz6lz NdIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gTey1wGd; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id lr14si408640pjb.64.2022.02.14.12.38.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 12:38:44 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gTey1wGd; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E3A7911ACF1; Mon, 14 Feb 2022 12:07:17 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245147AbiBNJtS (ORCPT + 99 others); Mon, 14 Feb 2022 04:49:18 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343766AbiBNJq1 (ORCPT ); Mon, 14 Feb 2022 04:46:27 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C5776B0AC; Mon, 14 Feb 2022 01:39:56 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9B294611DE; Mon, 14 Feb 2022 09:39:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EE73C36AE2; Mon, 14 Feb 2022 09:39:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644831595; bh=P3qbYayGFjFb/gkQnpdVwoJRURSj299ER3xrYVzQ6Bw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gTey1wGd+ABT8Uhdpd8I652Pd4z02SCzxxCSwX9jXF11IVInIbFBMlGQL6dmqLkaF EIAkcxagKMd6Xms/HvWQVZ4kFuhtbGtxPmfr0fb/1S9edSBhGri6qufyaI7zrmYowI Adu+7jWbIxu/Y0MfUscG9d3j/MPONUsS1s32E0+c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hannes Reinecke , Tong Zhang , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.10 031/116] scsi: myrs: Fix crash in error case Date: Mon, 14 Feb 2022 10:25:30 +0100 Message-Id: <20220214092459.767457421@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092458.668376521@linuxfoundation.org> References: <20220214092458.668376521@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tong Zhang [ Upstream commit 4db09593af0b0b4d7d4805ebb3273df51d7cc30d ] In myrs_detect(), cs->disable_intr is NULL when privdata->hw_init() fails with non-zero. In this case, myrs_cleanup(cs) will call a NULL ptr and crash the kernel. [ 1.105606] myrs 0000:00:03.0: Unknown Initialization Error 5A [ 1.105872] myrs 0000:00:03.0: Failed to initialize Controller [ 1.106082] BUG: kernel NULL pointer dereference, address: 0000000000000000 [ 1.110774] Call Trace: [ 1.110950] myrs_cleanup+0xe4/0x150 [myrs] [ 1.111135] myrs_probe.cold+0x91/0x56a [myrs] [ 1.111302] ? DAC960_GEM_intr_handler+0x1f0/0x1f0 [myrs] [ 1.111500] local_pci_probe+0x48/0x90 Link: https://lore.kernel.org/r/20220123225717.1069538-1-ztong0001@gmail.com Reviewed-by: Hannes Reinecke Signed-off-by: Tong Zhang Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/myrs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/myrs.c b/drivers/scsi/myrs.c index 78c41bbf67562..e6a6678967e52 100644 --- a/drivers/scsi/myrs.c +++ b/drivers/scsi/myrs.c @@ -2272,7 +2272,8 @@ static void myrs_cleanup(struct myrs_hba *cs) myrs_unmap(cs); if (cs->mmio_base) { - cs->disable_intr(cs); + if (cs->disable_intr) + cs->disable_intr(cs); iounmap(cs->mmio_base); cs->mmio_base = NULL; } -- 2.34.1