Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp450407pxj; Thu, 20 May 2021 13:13:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWhcjGT6ICcDJc40Ye2sN34IhIkiOCjGahZLfiiWea8HW1l0zX5a9egWusSzDZ3r0cSa9i X-Received: by 2002:a02:7fc1:: with SMTP id r184mr8979723jac.109.1621541630192; Thu, 20 May 2021 13:13:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621541630; cv=none; d=google.com; s=arc-20160816; b=w3kKP5CwP2xi1r0OvxygNBsHLGU2hGQJE6/hFOsVJV64LS3G4ujJ3NPbw8FuEW3Abm kDTZ1qFwyvVERBKpbNK8FsMzDVizorby48FEqh6fdqy3ofTGjZQb8eCEmCNymWvOIhQP q69+WckwMR9fo2WrrcD9KeNXRu73LP37++P3e84DIWwGTlB1mHaw3YNbLJTKzz3zDNfZ fOBRnY+VZGqyWLp6MownnY70Nt6PxuRJ+KUVohhd8r3nv+6Jo+Rj16SUUEt7O/QIskpR AuQyVSu7cEVNkljPTEPLGgrN/KU83GH/fz7wUtDOHl5j2ddhysa84UdpMsfuIzR6cK/o od+g== 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=hhXSJHOOgLynk91AsFefVyfYy0wkujjDS0ZXN0e8gXo=; b=hIaE8VfJnG8+RXfUaGL/e8wiYaI0Cbofml1NWLBcBcsdkEgwcNzMPMsd4o2cygDX4B ErFygCe1Hqug0wWFYU/WE+gJIXS/Cv2ZWXPtH+rVAeZkCuFDssFXevxP860nVIzhvtQX bBSfRaBY0ySYoHbPMZtP+Z9ch8qzRh8pUsYS0HmVAhRzqJFIVWSHsLf2abwS5T1pv3ji 1Wacn5v5hJqf6SEzffI2Lho2Ov5LHRNZxkkRDYH6RJGomIFBl4ugEyMgbPVKrqNnMyOI y6vap6Y6hRX23tehzFHyzQDdeWak4mt8CsH+i03Kk85Nr6S8ePJ/hdqO+q/sZ6Dhodcr Hl9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HRQHDFRM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b18si3848159ile.24.2021.05.20.13.13.34; Thu, 20 May 2021 13:13:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HRQHDFRM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237889AbhETKrK (ORCPT + 99 others); Thu, 20 May 2021 06:47:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:60372 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237071AbhETKb1 (ORCPT ); Thu, 20 May 2021 06:31:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6C62361493; Thu, 20 May 2021 09:51:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504318; bh=cDsNEF8pfcgYPEdhQPiH+XfrzDWIabER0r31WivNClA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HRQHDFRMMkaM4pNVMkfj5WX3G2GMuMIm/4/wfe0Q5QbMbZbeDRjurU/PhfKgRLwts d3t0dO7tc/EZ7RlfaU69Me65RFtxAjLiwHscGhMODG7s+u7Hd1RiGYEXP0jcVd1bSS KYTvrt/PJGTqov6OrQ96X+Vj27+gX8wCkMyohsPQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.14 191/323] scsi: sni_53c710: Add IRQ check Date: Thu, 20 May 2021 11:21:23 +0200 Message-Id: <20210520092126.665876488@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sergey Shtylyov [ Upstream commit 1160d61bc51e87e509cfaf9da50a0060f67b6de4 ] The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to request_irq() (which takes *unsigned* IRQ #s), causing it to fail with -EINVAL (overridden by -ENODEV further below). Stop calling request_irq() with the invalid IRQ #s. Link: https://lore.kernel.org/r/8f4b8fa5-8251-b977-70a1-9099bcb4bb17@omprussia.ru Fixes: c27d85f3f3c5 ("[SCSI] SNI RM 53c710 driver") Signed-off-by: Sergey Shtylyov Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/sni_53c710.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sni_53c710.c b/drivers/scsi/sni_53c710.c index 3102a75984d3..aed91afb79b6 100644 --- a/drivers/scsi/sni_53c710.c +++ b/drivers/scsi/sni_53c710.c @@ -71,6 +71,7 @@ static int snirm710_probe(struct platform_device *dev) struct NCR_700_Host_Parameters *hostdata; struct Scsi_Host *host; struct resource *res; + int rc; res = platform_get_resource(dev, IORESOURCE_MEM, 0); if (!res) @@ -96,7 +97,9 @@ static int snirm710_probe(struct platform_device *dev) goto out_kfree; host->this_id = 7; host->base = base; - host->irq = platform_get_irq(dev, 0); + host->irq = rc = platform_get_irq(dev, 0); + if (rc < 0) + goto out_put_host; if(request_irq(host->irq, NCR_700_intr, IRQF_SHARED, "snirm710", host)) { printk(KERN_ERR "snirm710: request_irq failed!\n"); goto out_put_host; -- 2.30.2