Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp858066imn; Tue, 26 Jul 2022 11:12:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sl4MMJvKTp0q5e5D3I3Nes9dQ5fnwBEXZnwUwR+/2AtuzAp2NeK+yTwc5MReqSGKQQP2zV X-Received: by 2002:a05:6a00:4148:b0:52b:603c:d3a with SMTP id bv8-20020a056a00414800b0052b603c0d3amr18713056pfb.3.1658859157180; Tue, 26 Jul 2022 11:12:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658859157; cv=none; d=google.com; s=arc-20160816; b=e0MtAZuCpHNft/6xEcQ8cTjFC/oLEPgPfYDle8P0SFWkF3yKTgESm2F8wt935Qalah prIykPF/F1Usdhtuw9n5xHBI4Ms4yiketr9p6Lm6YFAQGZnodQZ/6ogTkn8JOYxNUwmN ZnOf1PGCXj2jjfeZXvAemis/EDEu1ylQeA7OAHoLq0ocgPoFugvBFp83AEZrwnQuuBhp Lypjjz1bLmLJ3GljTL/tuVBxeODc5VxhXwPGC23rfP+ejXixK0SeWKRnfrTCGLS9hFvd vU3sCILfSEG9/OuJNXd3vPi1/vKQVQdoarHsE4Nqf6lr59Jy4I7Q8pNFswgQa95F42Vz NCHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=NZY95oz+3nc12JdnJ1V2egHzYXhGkXz6OJbtcJkYG2o=; b=ZQSf/fmIcBpFb2j2Pz3KLRxlayBgVlvO6mCdTuMI+lSxQy7tRZdE/147w40rLkbbXF UlECj8vQnpGrAwDe876u01et+Bcg+s3WImtrKWqdoaNuWIJmyAkQpZGzm9y/E4CKupB0 8Wv70xNb6yYaHac2x9Nto3JjGjNY0XDlWQzJD4m1qSr8Q7zswleEez6zWW1iJgNDR+wr IfRtqdcgh5H663XWX9Wt61gcA+KX6KJB7Ivncv5S3n6+cw1scNl4Zgb9sVXblHI4x2yg ZFmbF/HWOy7SVOlKybZBw3b3wkyMvTT91ysqGuts31vlBNv6JWxRKMsd22ogcaXEk3W3 lq/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AHu3lwB8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 8-20020a630508000000b0041a4f4a2afdsi15753504pgf.766.2022.07.26.11.12.22; Tue, 26 Jul 2022 11:12:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AHu3lwB8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239105AbiGZRzH (ORCPT + 99 others); Tue, 26 Jul 2022 13:55:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239853AbiGZRyr (ORCPT ); Tue, 26 Jul 2022 13:54:47 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 672BE30F6C; Tue, 26 Jul 2022 10:54:07 -0700 (PDT) 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 sin.source.kernel.org (Postfix) with ESMTPS id 378E5CE11E0; Tue, 26 Jul 2022 17:54:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32FB8C433C1; Tue, 26 Jul 2022 17:53:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658858042; bh=MTd2fTAvNUmuqKVSjZqDvs/4KSGaAZDJjBUdCfoNxoE=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=AHu3lwB8caO18Cqx0Six5fBB537DDG5SgSwgYiwM0v6qFGFJhI71wp8keugPVtw4j hTyDNOQHmw5yTDfki9yvxdV9S2shoC6gYPKRALh21LlChG6UEi4gwpmcqAHWT3plsb hCAWJME/nUa9QvwvunQMQEKCrLMWwZWFzFdliUXhlqssALibwVqLw3TcOwI3yIbGDC Dym5hs6AoIAFfvFJTCWcOCug7AuEDe+adoW8w0gcKllsofJEypQiujmeiKb3kLch0K qKcTKyMvCdHAiOsxjRTY33nnDDlOnSLaPo105MHwqX4apmhHBm+2GxYSMH7hTEfSCR GSBikSfYUdNuw== From: Kalle Valo To: Manivannan Sadhasivam Cc: Qiang Yu , quic_hemantk@quicinc.com, loic.poulain@linaro.org, quic_jhugo@quicinc.com, mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, quic_cang@quicinc.com, ath11k@lists.infradead.org Subject: Re: [PATCH v3 1/1] bus: mhi: host: Fix up null pointer access in mhi_irq_handler References: <1658459838-30802-1-git-send-email-quic_qianyu@quicinc.com> <20220726080636.GE5522@workstation> Date: Tue, 26 Jul 2022 20:53:58 +0300 In-Reply-To: <20220726080636.GE5522@workstation> (Manivannan Sadhasivam's message of "Tue, 26 Jul 2022 13:36:36 +0530") Message-ID: <87czdrrc95.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Manivannan Sadhasivam writes: > +ath11k, Kalle > > On Fri, Jul 22, 2022 at 11:17:18AM +0800, Qiang Yu wrote: >> The irq handler for a shared IRQ ought to be prepared for running >> even now it's being freed. So let's check the pointer used by >> mhi_irq_handler to avoid null pointer access since it is probably >> released before freeing IRQ. >> >> Signed-off-by: Qiang Yu > > Reviewed-by: Manivannan Sadhasivam This fixes the crash and my regression tests pass now, thanks. But please see my question below. Tested-by: Kalle Valo >> + /* >> + * If CONFIG_DEBUG_SHIRQ is set, the IRQ handler will get invoked during __free_irq() >> + * and by that time mhi_ctxt() would've freed. So check for the existence of mhi_ctxt >> + * before handling the IRQs. >> + */ >> + if (!mhi_cntrl->mhi_ctxt) { >> + dev_dbg(&mhi_cntrl->mhi_dev->dev, >> + "mhi_ctxt has been freed\n"); >> + return IRQ_HANDLED; >> + } I don't see any protection accessing mhi_cntrl->mhi_ctxt, is this really free of race conditions? -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches