Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp96749pxb; Thu, 31 Mar 2022 00:12:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypTFLJOJeZrUf6Tmuz2Jv3h7Ri8ty3TCL3rySE5qppCrg0fso2KIKPPFINE0R0NmOg74SO X-Received: by 2002:a05:6402:2342:b0:419:e86:c7d5 with SMTP id r2-20020a056402234200b004190e86c7d5mr15234747eda.92.1648710729074; Thu, 31 Mar 2022 00:12:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648710729; cv=none; d=google.com; s=arc-20160816; b=HCgnAxP0702vx9i9fTMy0blLDKoLpQQ7ROHahlKUIXmJ7fHlY9bKj4ewRl4ySqwDIL PaC8EHb3ut+at/P6iqngc6W1Po1TaRVCZiVOL7E470nDyUGEilq4osnbb2+WfJihrFDQ l32p8KbrnhTC0WnKd/Nzvfob2/BAxbFQX1IuaBhU2uxB0rxgLp1uimJWgwlWVQZfCZda kxaq7/1DLuVEdyWl+67JF5Ldkn3ItySl9Gq/eEVTcX5u6Da9D32iuCYucD/+gvJm6qvZ q+CbiU4DsJnKbUBZE7TM5BLKwLGUgE9lXYe4jd9srBGWuNYeVt+y5+0R/xEJvzvP1wZ1 gS3g== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=4h5E2nzr5C4cKPBRgZcWuYY70PjYBahLeosM/hmNAoc=; b=XmRDqCd2u7WQ3BdG1vpBr8NH940fu4UVeDHSJ6HBoHk1evFbCiFiL6FTz6rPjAeogd NcBne6YbvgJjFfHxo5Z6pc0RVJiTajSN/flsFo7u0EcLcc4zh3U03tkggxzqkU7qlmnK J+dyXO363PywffUa/F12wm7IK+J9COT8hnctBfnipQ9oSycMI+oQjWIB0E+ZxP3g4X7w b5ptN6W0jAiWoimMX35P4gZtdkLT26A/rHIFW7x2zDmUrCPmYtmjyTmRSI8MRGU+uGtG 9e8s9yzPZRmm48ZvV71o4dlbCCAj3PP4FuibB0dYk57Yu9X85KsjtSKnmKFUFHVcN6B+ F8Xw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gv26-20020a1709072bda00b006dfd28d349csi21451816ejc.119.2022.03.31.00.11.42; Thu, 31 Mar 2022 00:12:09 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231126AbiCaG1O (ORCPT + 99 others); Thu, 31 Mar 2022 02:27:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230520AbiCaG1N (ORCPT ); Thu, 31 Mar 2022 02:27:13 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0828A1ED070; Wed, 30 Mar 2022 23:25:21 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 45FA080FA; Thu, 31 Mar 2022 06:23:13 +0000 (UTC) Date: Thu, 31 Mar 2022 09:25:20 +0300 From: Tony Lindgren To: Jason Gunthorpe Cc: Lu Baolu , Joerg Roedel , Christoph Hellwig , Ben Skeggs , Kevin Tian , Ashok Raj , Will Deacon , Robin Murphy , Alex Williamson , Eric Auger , Liu Yi L , Jacob jun Pan , David Airlie , Daniel Vetter , Thierry Reding , Jonathan Hunter , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Christoph Hellwig , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, regressions@lists.linux.dev Subject: Re: [PATCH v4 8/9] iommu: Remove unused argument in is_attach_deferred Message-ID: References: <20220216025249.3459465-1-baolu.lu@linux.intel.com> <20220216025249.3459465-9-baolu.lu@linux.intel.com> <20220330142340.GA2111031@nvidia.com> <20220330173323.GA2120790@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220330173323.GA2120790@nvidia.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Hi, * Jason Gunthorpe [220330 17:31]: > On Wed, Mar 30, 2022 at 08:19:37PM +0300, Tony Lindgren wrote: > > > > > __iommu_probe_device from probe_iommu_group+0x2c/0x38 > > > > probe_iommu_group from bus_for_each_dev+0x74/0xbc > > > > bus_for_each_dev from bus_iommu_probe+0x34/0x2e8 > > > > bus_iommu_probe from bus_set_iommu+0x80/0xc8 > > > > bus_set_iommu from omap_iommu_init+0x88/0xcc > > > > omap_iommu_init from do_one_initcall+0x44/0x24c > > > > > > > > Any ideas for a fix? > > > > > > > > It would be good to fix this quickly so we don't end up with a broken > > > > v5.18-rc1.. > > > > > > > > For reference, this is mainline commit 41bb23e70b50 ("iommu: Remove unused > > > > argument in is_attach_deferred"). > > > > > > Are you confident in the bisection? I don't see how that commit could > > > NULL deref.. > > > > Oops sorry you're right, the breaking commit is a different patch, it's > > 3f6634d997db ("iommu: Use right way to retrieve iommu_ops") instead. I must > > have picked the wrong commit while testing. > > That makes alot more sense > > > > Can you find the code that is the NULL deref? > > > > I can debug a bit more tomorrow. > > Looks like omap's omap_iommu_probe_device() is buggy, it returns 0 on > error paths: > > num_iommus = of_property_count_elems_of_size(dev->of_node, "iommus", > sizeof(phandle)); > if (num_iommus < 0) > return 0; > > This function needs to return an errno -ENODEV > > Otherwise it causes a NULL dev->iommu->iommu_dev and dev_iommu_ops() will > crash. You got it. This fixes the issue for me. Looks like the regression already happened earlier and recent changes just expose it. For reference, fix posted at: https://lore.kernel.org/linux-iommu/20220331062301.24269-1-tony@atomide.com/T/#u Regards, Tony