Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3971925pxb; Tue, 25 Jan 2022 00:19:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJyhMt5WX4fwWIZ9KUb+5VEHWpRZnE74ssMHAxT6za/7dSocU+GTERSliVr6EyIOHwq8ct8+ X-Received: by 2002:a05:6402:b44:: with SMTP id bx4mr19210492edb.409.1643098678715; Tue, 25 Jan 2022 00:17:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643098678; cv=none; d=google.com; s=arc-20160816; b=sZgtgqck2w3YJd6nY/beZh0S803yeyTiFfUrOqvB5I21cxksfghbILdXb8q8aTTqo9 kzYOoE9MAU9qVsAinSyMdhSfA0kUVT8467DY9ZE05DoZ0t3HkH/RTqkRLxlgba2vmi4K e/HFIfasRQalPfVQKx/JNruhTLor/0DL4nQForZ7qfffVGhIoEPMKoobMr4JYs7AnTGw Hm6qbaq1NInZLYWV/NhZ5BxbnKag4+fHnhiwIvdKNV1f4CZ6OUkQIdVj3tHr8/5RnWQK PnizaOjeatJeCy/NptlBmtIMqvHWG84jX5+61h5zfrnrg5aYMUw+knbXsT6mfAKYCc2o U6UQ== 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=+MOTtcO4FeCBqAJ+4z5LXn+MQHpWSEqKtZWJRG9Pnwk=; b=q6OOLSu2icWtpqiRFOtGz9fR74HtYRra3bWnBOgXc08TZq+FMk9ZGHgh5Ej2kbbg6L wRcno1B4FlDFGWBg9ZR9uTaEurcS0NkdC7ncqq8H/FG7GQQwdykdUxf2EXmTnME7VO4x a3O5qf6NqkKy3fx7mlva98PUIw5QSLOO9O5rB/LlRTue0oWSnoN1U9TiYy8AGoQKF/qj HNMNHhad0Dy2f4Tom0bA6jNeWDtS5xhIb4RjgqZiFWxS1XkTyo63Yis2gyG2+c0aPUvt 47QBRLuLjw7GQWRxIs6XBqZKINOGPWdmhxU7KfSp5TfChroYrjqP+86XDlqqQ6+0guga 0cAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=auocqY5X; 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 w6si3031968edc.469.2022.01.25.00.17.33; Tue, 25 Jan 2022 00:17:58 -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=auocqY5X; 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 S3412697AbiAYAhf (ORCPT + 99 others); Mon, 24 Jan 2022 19:37:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2366208AbiAXXwa (ORCPT ); Mon, 24 Jan 2022 18:52:30 -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 6A1B6C07A960; Mon, 24 Jan 2022 13:45:22 -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 0529960917; Mon, 24 Jan 2022 21:45:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA44EC340E4; Mon, 24 Jan 2022 21:45:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060721; bh=50IGVVTLdTnXb61ETsYNp6mE39BCkHix8fK1hsjK62U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=auocqY5XBhFkKGv7W3HFBDC7CvKpdI6RkcJTjtU55p3+lyQTSv5B44iURuYwTQ4sd ClT7exzAQZM2/H87wBKTFRhGN45OeP2WnpwbpOt+2WHxawJaOk7LYzsP4vgcTGXOc0 aoKQ+srQVFCEJmdxF68dBeGwg1s/vfmxNWrwHVTg= 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 5.16 1013/1039] bcmgenet: add WOL IRQ check Date: Mon, 24 Jan 2022 19:46:42 +0100 Message-Id: <20220124184159.344664381@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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 @@ -4020,10 +4020,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