Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp314556imn; Fri, 29 Jul 2022 07:42:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Jqx1HIdyYpEokM0xCR2vmF5KxqFvvQukQNahlpUAvHwRXdG1S4joG22S4nHSbL6dWNrrZ X-Received: by 2002:a17:90a:a2a:b0:1f3:1479:e869 with SMTP id o39-20020a17090a0a2a00b001f31479e869mr4444447pjo.41.1659105745648; Fri, 29 Jul 2022 07:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659105745; cv=none; d=google.com; s=arc-20160816; b=SGnVryHnO6vyW5a3nSV0d+WVgpO6qJnfkUvYGlHgBF8Hra+yG8Pp0e+NrLb13Quasz qSkFSl/9T2lhYvn32C+0iSXLzf1qy9S456N1Ni/AHq1VPMb/ErO9WvMe9e8P+zE14I6C Dl/vD1rnVrqayndk7bkJBkgdJs7cKNrUvjX4nt/BU8xtr1ManphWUTLjORFZGMiKPcag WfJYc62iHYJRjjoUkOZz0v+V8qHOgKSaQKaWbAkmRwXAJsG8wJw1PYaF6mMyJDdIWD4j HG97q8GhyHfbeX7QSrRBokZ1+PbDXTLLcLvJE1rImstitmTin4pn3CLj/45ndEdodoOh 59Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=8G82jtra1gZHcPF23MX3WULQPIMM01+65SCTrE21aZw=; b=BIjrkNJFlRi2U+mC523hsvptUw4dDK9sX9UAwL24k2J4bRAy7nxSYMZC8mIZ7HgYYC EZK6M+5rALS8Fv/2j5k9jjgKRishAoRvbFwf4+Hl3HTwlZc+MqtvL2dranRrjjJtEm/x wquLI9jkV3mmgMK2o61TNF4F8aTSsF33BEKCpjKnQrFlah6UBaPj1WfwwrVmrhjYeI4K Wxf8xBfDEa2aEdoXNJkR/IN9nL6AQZDAMvoawnaLt6tXxmEi5q/U2dnjhkoBOE9lN6x4 Sx6FwAN+d9fGAxH7c0OeRWCLjFlA6khC/eEHolmmHDtt6Gr/sWfhcFIROERDki2meTdn pmLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gI52e6Jn; 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 k2-20020a17090a9d8200b001f319ea8356si3758629pjp.96.2022.07.29.07.42.11; Fri, 29 Jul 2022 07:42:25 -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=gI52e6Jn; 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 S236973AbiG2OWe (ORCPT + 99 others); Fri, 29 Jul 2022 10:22:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236293AbiG2OWc (ORCPT ); Fri, 29 Jul 2022 10:22:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED97656B8B; Fri, 29 Jul 2022 07:22:31 -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 ams.source.kernel.org (Postfix) with ESMTPS id 9E0BEB82808; Fri, 29 Jul 2022 14:22:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 624B8C433C1; Fri, 29 Jul 2022 14:22:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659104549; bh=FYp7dxRuDa2TzbtLpfE1k1l6o7hR4ycZLxQgQwCsplA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gI52e6Jn7VE10U5yCiJqdCtJ8vq4VD1COs74rMHOXEDNUAB313zvt0660JPDJ89vL uRPByAcorrzRsXtzw4UHnEJYFgnZ0epF0+cuXPtDnI7WiYrbh8tDpLbH5ehEusMPBg eNhTd/WKCWFGW0aqvwRSSQZedj1nbkhf51FcitmIv3mV+5IihAseMfE30NzpLOZ+yz Vbrkd030U5POnTAx7Z0DMhjniNQpxIMtQyv4s34uHp67VcwJhg0wPbvzzST6nu9tlq e55lT7qkLZFj0rAWah49KRFUemdcWzLi8jfIAxIEaMFW92wBqgfG7GfQR8uG/sz0BC dVxKcR7Sz1vGw== Date: Fri, 29 Jul 2022 19:52:21 +0530 From: Manivannan Sadhasivam To: Kalle Valo 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 Message-ID: <20220729142221.GA9937@thinkpad> References: <1658459838-30802-1-git-send-email-quic_qianyu@quicinc.com> <20220726080636.GE5522@workstation> <87czdrrc95.fsf@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87czdrrc95.fsf@kernel.org> 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 On Tue, Jul 26, 2022 at 08:53:58PM +0300, Kalle Valo wrote: > 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 > Thanks Kalle! > >> + /* > >> + * 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? > As Qiang said, it is safe to access mhi_ctxt here. Thanks, Mani > -- > https://patchwork.kernel.org/project/linux-wireless/list/ > > https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches -- மணிவண்ணன் சதாசிவம்