From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB4F4C433EF for ; Mon, 17 Jan 2022 11:36:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239158AbiAQLgM (ORCPT ); Mon, 17 Jan 2022 06:36:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239124AbiAQLgL (ORCPT ); Mon, 17 Jan 2022 06:36:11 -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 8E6FDC061574 for ; Mon, 17 Jan 2022 03:36:11 -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 22BBE610F4 for ; Mon, 17 Jan 2022 11:36:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A31FC36AE3; Mon, 17 Jan 2022 11:36:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642419370; bh=CLGTbpfoFdA55E875m2mlLEfgRpXjRFZdGbDpJy3mjU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=mSz0xXmARng6glNWGdGmPVEJpYdXsG9RzZ2tLdhDrbftduQTxWW/XTI/D5BddxrxR gWf7dcvcL25OQClZPWPPP8tT2ms4rcg1W9x8shEa/YqLpGSNVBTmCRX9jdWAs0WeqM BViB5hTArFxMdOZsMZWomMHM9zbjUR+E3exBZ+5zCgQ5YXJg/76N+yl0sDu2bsm1Jo KWZQegHzvtdMrOMfXe8ytc8ZWxTEbzuQS43YOolPb48scn6iUPgBYUEFxwwJDN7IU4 dvhaKrWKqC6Z42mhDWxhRvkXhfqStmJYqRzPcbqtdOsvslU64mW8+API1mx+Ygv+tl /skRQtqJrQ3Zg== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1n9QIy-000v28-Hb; Mon, 17 Jan 2022 11:36:08 +0000 Date: Mon, 17 Jan 2022 11:36:08 +0000 Message-ID: <87h7a28uhj.wl-maz@kernel.org> From: Marc Zyngier To: Tong Zhang Cc: Thomas Gleixner , Jason Gunthorpe , open list Subject: Re: [PATCH v1] genirq/msi: fix crash when handling Multi-MSI In-Reply-To: References: <20220117092759.1619771-1-ztong0001@gmail.com> <87ilui8yxt.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: ztong0001@gmail.com, tglx@linutronix.de, jgg@ziepe.ca, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Please avoid top-posting. On Mon, 17 Jan 2022 10:10:13 +0000, Tong Zhang wrote: > > Hello, > > ops->msi_check could point to pci_msi_domain_check_cap that is the > function in question > > hence we can have following call stack > > pci_msi_domain_check_cap (used by ops->msi_check(domain, info, dev)) > msi_domain_prepare_irqs > __msi_domain_alloc_irqs > msi_domain_alloc_irqs_descs_locked > > What I am suggesting is commit 0f62d941acf9 changed how this return > value is being handled and created a UAF OK, this makes more sense. But msi_domain_prepare_irqs() shouldn't fail in this case, and we should proceed with the allocation of at least one vector, which isn't happening here. Also, if __msi_domain_alloc_irqs() is supposed to return the number of irqs allocated, it isn't doing it consistently. Thomas, can you shed some light on what is the intended behaviour here? Thanks, M. -- Without deviation from the norm, progress is not possible.