Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4175266pxb; Mon, 8 Feb 2021 09:38:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJy3dUxsZIEMGDATbSvS+BcjH1Y+3useIb7WTJknqSmvqJQVbsaOH4z2dfKnOGkSv8UPxsBe X-Received: by 2002:a05:6512:a95:: with SMTP id m21mr10978672lfu.460.1612805899990; Mon, 08 Feb 2021 09:38:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612805899; cv=none; d=google.com; s=arc-20160816; b=wsSG1pZk7N4f4vUW6B1n73gh15Ab0QHzUYz/S+qRcsCLkhlK/LCfZii7USbU17Q6eN EjFLSJBcBRjaPV2rH/56ZssY4FbmCY0HBc8RczNBoOsKKrHzA4CwQyCU058wvbZwlrIt dl6+UrkNRUb8FAlZnyAUayWyTtDU3FfWAu8xpXQ9MRChMC2ZVnxFkMVBzVUjhmxut37N JglSkfbbUpLjK/kJAYERkjEyvP8ZzDZVvYk4capPRIhDRPvBS03JUaoFSCI1exTKDSQ4 Q13wz7a3JSvgbNocJGsM9tM8Gq4Sm5G8xiiEUJiLtQiG/B0f6uwylT+gXbfs4MFooAFW FgXQ== 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=o+Jwh78frRPSsYc52fSTaz72RSVwUNKIwu64ZUq0ltI=; b=OkmcFfcw9hRjhJqrNEx+Sdc31y9gj8bEvVcni2Wy1cgvGwA04g1nWnZkerUxffLibC 8CMXPiJ7SaKYTok+4AQqZsEvLgiBg5RWauAEi+Is0/x7VQ3/oJJfTsK2SKzsgfzuzjmG nzOS2tLttY+GN8MCN0dHfkEMNLURAb1G8+ESQscEjD+r8fMAhdQC9FQTx9v6VSrZ/59K l/V0m0wG8iCqehf0j6UGS23G+tVEP/EJQKCzpfljz8b51qtw3W5JQjzbQz07wjQamU14 DdSfLkPED/Pdk0stQZuJHPxDDwa61bl13qf7S6hSD9MZub9U/tFGzwYKuFEHE9gu0YwF Dszw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZmG9wjXp; 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 g8si11371090eds.525.2021.02.08.09.37.56; Mon, 08 Feb 2021 09:38:19 -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=ZmG9wjXp; 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 S233081AbhBHRgx (ORCPT + 99 others); Mon, 8 Feb 2021 12:36:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:37830 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233678AbhBHP3o (ORCPT ); Mon, 8 Feb 2021 10:29:44 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E0C0D64F2F; Mon, 8 Feb 2021 15:16:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612797405; bh=x3SUHPR1hOCknJIMUCkwaNMMAOZGaXKzLs2YmmUqN40=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZmG9wjXpN2GCbm7/hKYQ/0UHKTnd0s4FW5Zb7wt2zJS4vIgxd84rKeloWd4lIWoBI +RuLTiyHPt78a4pK42tBRDD/WNAjvG/ND7AIXgz6V6kyxEuzxl45k0KG1+GZc0JBCU j2q2YnjMVz05kXxRSsFD2a7tQE1dkfIu1TR3veVo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Thomas Gleixner Subject: [PATCH 5.10 066/120] genirq: Prevent [devm_]irq_alloc_desc from returning irq 0 Date: Mon, 8 Feb 2021 16:00:53 +0100 Message-Id: <20210208145821.049459874@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210208145818.395353822@linuxfoundation.org> References: <20210208145818.395353822@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: Hans de Goede commit 4c7bcb51ae25f79e3733982e5d0cd8ce8640ddfc upstream. Since commit a85a6c86c25b ("driver core: platform: Clarify that IRQ 0 is invalid"), having a linux-irq with number 0 will trigger a WARN() when calling platform_get_irq*() to retrieve that linux-irq. Since [devm_]irq_alloc_desc allocs a single irq and since irq 0 is not used on some systems, it can return 0, triggering that WARN(). This happens e.g. on Intel Bay Trail and Cherry Trail devices using the LPE audio engine for HDMI audio: 0 is an invalid IRQ number WARNING: CPU: 3 PID: 472 at drivers/base/platform.c:238 platform_get_irq_optional+0x108/0x180 Modules linked in: snd_hdmi_lpe_audio(+) ... Call Trace: platform_get_irq+0x17/0x30 hdmi_lpe_audio_probe+0x4a/0x6c0 [snd_hdmi_lpe_audio] ---[ end trace ceece38854223a0b ]--- Change the 'from' parameter passed to __[devm_]irq_alloc_descs() by the [devm_]irq_alloc_desc macros from 0 to 1, so that these macros will no longer return 0. Fixes: a85a6c86c25b ("driver core: platform: Clarify that IRQ 0 is invalid") Signed-off-by: Hans de Goede Signed-off-by: Thomas Gleixner Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20201221185647.226146-1-hdegoede@redhat.com Signed-off-by: Greg Kroah-Hartman --- include/linux/irq.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/include/linux/irq.h +++ b/include/linux/irq.h @@ -922,7 +922,7 @@ int __devm_irq_alloc_descs(struct device __irq_alloc_descs(irq, from, cnt, node, THIS_MODULE, NULL) #define irq_alloc_desc(node) \ - irq_alloc_descs(-1, 0, 1, node) + irq_alloc_descs(-1, 1, 1, node) #define irq_alloc_desc_at(at, node) \ irq_alloc_descs(at, at, 1, node) @@ -937,7 +937,7 @@ int __devm_irq_alloc_descs(struct device __devm_irq_alloc_descs(dev, irq, from, cnt, node, THIS_MODULE, NULL) #define devm_irq_alloc_desc(dev, node) \ - devm_irq_alloc_descs(dev, -1, 0, 1, node) + devm_irq_alloc_descs(dev, -1, 1, 1, node) #define devm_irq_alloc_desc_at(dev, at, node) \ devm_irq_alloc_descs(dev, at, at, 1, node)