Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4618464pxj; Wed, 12 May 2021 09:21:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLc3kP8qFaIF+eEEs8VvoXoL4qlSonNAEG8EdLtXv2YH5ntmzb3AxxYAq630YSjEeUMFKR X-Received: by 2002:aa7:d4d5:: with SMTP id t21mr31046855edr.95.1620836470434; Wed, 12 May 2021 09:21:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620836470; cv=none; d=google.com; s=arc-20160816; b=pDUkqpVkinZDo7aBZxBSaZ1fcKM/1xlnXWWK01VpEhzSZWAxwLhgolRGaBrCWxCZNV 6tPbVt5KkyavJwNEwow96D8+X6Ptu6L6ArbMGoVmCy0pP44r71YIwnHvevROxcOkLuq4 mY2ljacON9yYJQo3b4IE/ZYyl8YMXrFxIOmVeryP06Ktg7Yh8kJdbUfKv3QKkcggLSxY SMPJgZ+kswfkN/MCVjTZ8seUNTO0D1Gaa0PeJOs4MLgv1oxCaVk9qISsnmcwrK9z68bE yBX9zr44JKWcjica7+9Y8OcZ46hhDaklo5JlDi6H2SwmPGPQ+y9BB7y9i13I8Xselmnj zAPA== 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=gvDFDChe4w6bclQrrBKFZtBmzkQ0UaUkNqIAqyGNOGQ=; b=DczFt3hjCs15DzsM5OEJ4FC77ozWNzKl1nh5AAVBV38jbmG3Rq+ay1dn0K1VZraVLE pSnSUqINzz1tPazg5VfELW+b2bbCAm2PkJcWIvzh5R1GJspyhSoCc0t78NZHa3JIgt0X ZrRcRnkJctuqIDZ9lWdGUZBZlEC+jYBOfHyopjf7FnfyfB5hJEevRDyfNiUmdoF9zPbA 3f3IJusFgRe1TxMEC5pLDjqI9kwMXLn/vYQshty3br278YF8b0vqbKBQ2KmfJ70NtaGi gszbDzlGHgBEaQDNI+PrXCdw27piMiFjWYTYwMhOlCVzm8c0s0DmfxbuNocyUFlgfX82 qphw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Gsq9iSar; 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 d7si159633ede.284.2021.05.12.09.20.45; Wed, 12 May 2021 09:21:10 -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=Gsq9iSar; 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 S240445AbhELQSG (ORCPT + 99 others); Wed, 12 May 2021 12:18:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:48794 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235009AbhELPfG (ORCPT ); Wed, 12 May 2021 11:35:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EE7B161C33; Wed, 12 May 2021 15:17:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832656; bh=kO8yA48hgkT1m02kdDNcbKCu3jksJOCsmIXPoQt2D7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gsq9iSareRYGLQjJ1HeLfkqQMc30kTvKNlncAqEXYO6J9T4UM6061fuhTKo1gp+sR tYrnqCB0CASh5AgIVRErNvXXGbtC7MP8Oxy24OKxqTWmwn+uZlabw+YoaqoIAKoJ+Y MUu+cjcjRv6sYW3/CCZRWYYalIT0875TyZyywQJE= 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 5.10 334/530] scsi: sni_53c710: Add IRQ check Date: Wed, 12 May 2021 16:47:24 +0200 Message-Id: <20210512144830.782750570@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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 9e2e196bc202..97c6f81b1d2a 100644 --- a/drivers/scsi/sni_53c710.c +++ b/drivers/scsi/sni_53c710.c @@ -58,6 +58,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) @@ -83,7 +84,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