Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp343790pxj; Thu, 20 May 2021 10:34:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfV3sHeG5TDTn2q/SLRG6OK/xTfLlpqASrz/gq48k8R9QmMDvsLtgC7xHDNHXA2ssUurTe X-Received: by 2002:a17:906:11d3:: with SMTP id o19mr5774097eja.387.1621532091236; Thu, 20 May 2021 10:34:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621532091; cv=none; d=google.com; s=arc-20160816; b=dYL+DccM0NWEvCRK3gpdY2qmVsRnKJmMk0cBNhv+4S0+65lUcW+BmF+I4WcqKrVEuv N+2dhZEvJyFC2I3ud4HZ7Ved07PI1vvwYCFJ1ijmgx+47fRuug43ihCrH4i1GnFDLsWk 0yjJpvNDJZcANp7XNQJGRVR6aDRSuhIeoux5PMabc4DGj1x6e/aEmbk2ULkOVZQ3D1OO 4Yu6BC2Jc7iR0+aPOBQyV2dqACVO2FFEO8bv73JThjSogWNhubAs+gZL86U6sTWURTxj 6T3J5Tpu77fR445H3oFcB50xPw/WRNeT61qGXliGc3VQ/jk3zTJdEojuqd4amOHYrMcy Ey3Q== 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=zmCwoFCV1hzDqevgBaHmECIeulJH9OcvhMJ6xm7mApR8OMtG4+je0jE0uZMdVmahGb 06E9feKKQz6X/uuDGdeNHJKjyLyXrlTozhKbNF6UenLreEUWfjp+paAzI1RD1VWB1Rc/ j70yjFJ797OJG1a6Gb17cNFEol2H4APVDoEGMqRHfz40UE4DM4iVQQI3hNaUsqHWJEzA osUw78bhC4dChMjRtKnK4vjKsptsWLNThz+U9ompB0kHYERYzrYRasbxP0HZUOD9hA0j G0TtAEGlXqCg8aiV3O1WjHWCZCPZY8AxDl/Bof8A9R/Y799HLOHPfrbrFYGOmkuiM/fA GenQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v7mODigD; 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 o1si2439800edr.22.2021.05.20.10.34.27; Thu, 20 May 2021 10:34:51 -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=v7mODigD; 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 S235089AbhETKCG (ORCPT + 99 others); Thu, 20 May 2021 06:02:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:59040 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235181AbhETJ5s (ORCPT ); Thu, 20 May 2021 05:57:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 24A636139A; Thu, 20 May 2021 09:38:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503482; bh=cDsNEF8pfcgYPEdhQPiH+XfrzDWIabER0r31WivNClA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v7mODigDpwNR/KkD8ZmhRrNvVIWxq4edOv6TI23JyG6lS8AAcPmEstQQc4lxYWlJP ZaImxwnp1SHF5BRUshsMcoy+uDsOf7m1qpPYeOJjy8SUFukd13k5WlSSZ/VT3SAXHT XJLo+fbj33ilYl96luF9vll9WcX5G0+XBog8QgL0= 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.19 241/425] scsi: sni_53c710: Add IRQ check Date: Thu, 20 May 2021 11:20:10 +0200 Message-Id: <20210520092139.344583448@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@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