Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3549564pxb; Mon, 24 Jan 2022 12:00:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJzfQm9FTrPjuoXGjRe8J2vhgyXF7iat158Mg1qrZzcWlCznNEZDToE8YJo4W3DSDcUkNsVt X-Received: by 2002:a17:90a:bd01:: with SMTP id y1mr3450288pjr.33.1643054431612; Mon, 24 Jan 2022 12:00:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643054431; cv=none; d=google.com; s=arc-20160816; b=FRflaRgOIbQ5/OfL1PMRzP/PvIOHZYJFUqPAI+xtLgyM8fYSJw3BDlbECxPKOCR+gS gfPvSyW3f4GvvrIsDDHdIM8d7wTIW4RDaHBTgmbXgPmc0ybvaD3ARLinjNeweNWqtIwk cAP6cAcPCRAlp9xcQkXN1bygBiA1VM33tmnND89YwbC32RdYzKrz3Xkj07Xj6C8xOmeR x1CfF/2sVyRiOU6NJj7HGZ1DtYdtrGcVA5q019Kbj0EVl0qUe6jv3mxTYtL2B5eAKPy2 GWQia3Wg6JwDSF8hSNPx3gEJIWNZ1QR9igNOdyltbk+OLGiLhZRniIrYo2GbyEIg04IQ 6sVQ== 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=+Omu7WYoX/VzYN6UJWyL363aZWvRKrpS8S7m3bW1ApI=; b=smKtKsMO6ZV70FUTi2QV2Rpc361KBgKiEVcS2Ss4Fjqvyc4LD38xb+Dx7ll2IqSd3J DUlFaHN1bwg74nGuskeT/RLDruQTpx3CbazaGaefLtrulqteCxWLsV6GOkePwyfIoK5F lUAVfSQtN/pwzRauMCA/oxbZgMC9vxw+WtTMeIl7BODHggUHy0HtJQ7hyAzrzq53m5ED Ddx0L40vjaVihYMs1/c+vA4YmgtxXVaT44D66n01iQmrvzm0lSi/9S1ar/bXF6IfSt4v zrd7oepCi2xwFfEZe0nR0d4/FIEB07vCOxxXWaCDlomiNh89dCIpyC/6S0Zb76Jxrmst 2t9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ztXXCOND; 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 s40si3329069pfg.236.2022.01.24.12.00.19; Mon, 24 Jan 2022 12:00:31 -0800 (PST) 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=ztXXCOND; 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 S1343854AbiAXS5n (ORCPT + 99 others); Mon, 24 Jan 2022 13:57:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344628AbiAXSyz (ORCPT ); Mon, 24 Jan 2022 13:54:55 -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 A6EF8C061365; Mon, 24 Jan 2022 10:53:45 -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 4805161507; Mon, 24 Jan 2022 18:53:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C909C340E8; Mon, 24 Jan 2022 18:53:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643050424; bh=XyB6tBQRGSlyvJTRw3bhsJ6pQSHWxE71MEwmOka4C64=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ztXXCONDJxHbAz0xjaZNkOICZr16176JPpD3IFaTvSPMSxR0Ckd26+D5n8R4YBWC4 myjeTNnfrHqtt0mixhgrsFaC423AHurWiGEhQFnhqLm90N/1nVAa/2xA8vHUBAhiBi 5ph3ev9WCgYxa2tm8Gdo9um2VWsvpfiTKN/Oa0d8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Florian Fainelli , "David S. Miller" Subject: [PATCH 4.4 113/114] bcmgenet: add WOL IRQ check Date: Mon, 24 Jan 2022 19:43:28 +0100 Message-Id: <20220124183930.591414342@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183927.095545464@linuxfoundation.org> References: <20220124183927.095545464@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 commit 9deb48b53e7f4056c2eaa2dc2ee3338df619e4f6 upstream. The driver neglects to check the result of platform_get_irq_optional()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL. Stop calling devm_request_irq() with the invalid IRQ #s. Fixes: 8562056f267d ("net: bcmgenet: request Wake-on-LAN interrupt") Signed-off-by: Sergey Shtylyov Acked-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -3443,10 +3443,12 @@ static int bcmgenet_probe(struct platfor /* Request the WOL interrupt and advertise suspend if available */ priv->wol_irq_disabled = true; - err = devm_request_irq(&pdev->dev, priv->wol_irq, bcmgenet_wol_isr, 0, - dev->name, priv); - if (!err) - device_set_wakeup_capable(&pdev->dev, 1); + if (priv->wol_irq > 0) { + err = devm_request_irq(&pdev->dev, priv->wol_irq, + bcmgenet_wol_isr, 0, dev->name, priv); + if (!err) + device_set_wakeup_capable(&pdev->dev, 1); + } /* Set the needed headroom to account for any possible * features enabling/disabling at runtime