Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp633308pxj; Thu, 20 May 2021 18:30:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUompym2drk2tQv+uauPuUsNGKju9vIqFV46F/+/4itL5kYldmCAqnTHm34fvWCPL7+Dc3 X-Received: by 2002:a02:a80f:: with SMTP id f15mr475324jaj.101.1621560622992; Thu, 20 May 2021 18:30:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621560622; cv=none; d=google.com; s=arc-20160816; b=hdXpUBfV0/YOOHdv/eOit7C0LI6HQdlMCRJjteZxSoOgHvBzxYLwFKN3xM+cK+1ZBT 8V7aeoKcPlniz3WzhVGg8Hdrn+YNScAIrG5UtH93OrHoVfdmbqgKnUz04+7qZ4PGbLFb DkX1splD/E3Q67RJw+BPD40uq6wyeBmva5lSFx7ZjuYY7WdRasuh9PmKrK9VF/K560oP kEBkpw+n28lvnYO72B+amY3uPRCfHRnRoAIja4yjno4IT4ZIfQioc4RW42ttrNqnAkjR KQPFXCV5qYnGH6i6nQ7lXROZtiDWkPa32hbmpYTvHHwhRFciv/e4WABKQoTTKEprV/is WBWw== 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=oQrdpY/JJHlbt3IuOpAbwn1coSyfN42yEssf9J21IE0=; b=k7sx+7VLYfbWOiIEouEHkUVh8BYrBltC22vwmeeEbV7SmnHm4PGRAlJsn1UAeTLMW4 1bZJjUafdY/kPMS1IdGGjYQiWr+FydHM/T44ChtaDG8vSo7sIPn2wjMevGf5rn7TvD6I R3DEoL9TvYatJFysB7yCcE/zavKoQOf1CSmVyF0D1DATx++DOr/VwHpxE5vbFGOcU6Uy rGNqIKlnupO+coeopWRu0SEgiNfBmECk/p6e/kQeKufCXzwaYX8fIhSXtw8dwi1RB9Z8 Cnm8KVew91b/vGmIWUUUixhVHOjrPPz6HMjzzHUU1KBPxYusGtp0nA6u8k84OayZNpyN 4h9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wc21LRXQ; 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 k23si3720555iom.85.2021.05.20.18.30.10; Thu, 20 May 2021 18:30:22 -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=wc21LRXQ; 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 S242467AbhETLjn (ORCPT + 99 others); Thu, 20 May 2021 07:39:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:37946 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240504AbhETLRI (ORCPT ); Thu, 20 May 2021 07:17:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A0B3161954; Thu, 20 May 2021 10:09:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505382; bh=A2fJw8J4qkKI0mHDMqXWAWUio4MghHaOQNIakzht9Us=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wc21LRXQXVVvymdPtubrKXBhw2ewZyDN71ON1JhnlxT6ACGW9v0ACUH978d4PhxMZ PIdei0YVSeHpPsvXiAzinniilACI3dxAfTjEQ4H0MkOxTPUENWw9NWfbUmKljXwEU9 CmAzKgbkCg+gvAmgx0z8FHGn4Zuai858oBkDQAac= 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.4 108/190] scsi: sni_53c710: Add IRQ check Date: Thu, 20 May 2021 11:22:52 +0200 Message-Id: <20210520092105.762008910@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092102.149300807@linuxfoundation.org> References: <20210520092102.149300807@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 b0f5220ae23a..fad68cb028d6 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