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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2833CC433FE for ; Thu, 31 Mar 2022 21:22:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1fPrPcmikOCrWKEar9xTp8XbUU3tWSrSETq9IN5gzZk=; b=v1/FJBGF877TVo Y/+uww/8AdyTBjjchcpmjFVzgmy+2teSdPRRlqbS6hBJdGDJp0DFYSKK/PL5U5donFvtZsBaSaMS/ RI4JtZW0x9wNPUE0e28w+Y4/aJbFnaRmumBcHyORKWopORvPXD1I56ZwJta1YjEPibvAdir3SDLCi GMsomoWrTZpmqV3iZ2NUXcSbqCCUeS+NiuB2L+++CbbT1WD2mngPCToQMA9Xz1tLhkPqikja5x7Ld 0y58v0+xhRk16PrT83JjJscT1qifLUVfy2zI8mue/uMe3RiVSX+hto8kctVQSd76vGN1wb3d47OYq mJ0BLlzjDkLIbTmJWhVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1na2Dr-003hfb-5p; Thu, 31 Mar 2022 21:20:51 +0000 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1na2Dm-003hdq-AX for linux-arm-kernel@lists.infradead.org; Thu, 31 Mar 2022 21:20:49 +0000 Received: by mail-pf1-x429.google.com with SMTP id z16so789624pfh.3 for ; Thu, 31 Mar 2022 14:20:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=svILDDP1tn6CI+Hh0Pw/4JOxvuo1xmY6BRPzOQqbKnA=; b=2dfB71F+F3N1BfKx9Kxqczba2opQxpo/zINYmDd4Z6PXHpdG5z2OzDAKxa1LzSAN2o NZLwgyOtjG/8lurrH8qFyWYJV/Pg95fgv1vkBH2wPWnMFodh1pxrb7sCjZ6AMm0C2V7O z/1UUrjoDa0wF4nnzTPdb0nvS31OJRD1YTaLoQdKSVtJ4JIXkbY9xXcNpR1d6bHeYUPT 7xvX+7bMr+eTg1335pFdVFu79Vct8E2pml6eurl7lCseWgAjgQT4KckXOOq2T42BOX2U gIADtfu8r/GOugPUZh0BI1NVBb2CplcsFq3nFEC1dAZBfPu07+6dfq8NJx6JOwT3NRTv 4HAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=svILDDP1tn6CI+Hh0Pw/4JOxvuo1xmY6BRPzOQqbKnA=; b=KK7u8G7+SBvGVVyzYh8/x87tbAeARZZT099Mlp2igI6mylvasIyep22rYb8C3nV70d M/swvTHPcO0O513o3a8heEmIflFSsdmS2k6TZinEikfqcrbJHk70Uu/+l02Xo8CaDy/K wOFJaBLvj2nkhwmcfcB2SIv7s9pWGqulkABqvd5xCjcyz/GkNHWrikpxkZS2mOP1boam EO4gAcTt1Up4hDBpcY5vlBUPlIYMYGLAWOu/tap5XZu2Lh/q0oSMdp9/heteghXoPepz oVt+pwtlT2I5DpBQXRWyjsoqpK9LIikg0qUQObUTIWFxXggtSB2+63Y7xHJMwzM5zxvb v9Lg== X-Gm-Message-State: AOAM531z9Bs4qmevvI0mcMCA1WDpd/hHatVOofIltZbvlyH9YEBaPpiD HN2fn28uf+O8KQ6sM7p4MP1c5Q== X-Google-Smtp-Source: ABdhPJzbez47Mwv9eEJvyiKoQURSHppbrNG51hRYs1H49hqvBOEANdZiWlr9GFjGFb4JMXLR453jBA== X-Received: by 2002:a63:fb01:0:b0:398:bb8b:5796 with SMTP id o1-20020a63fb01000000b00398bb8b5796mr5246092pgh.351.1648761643753; Thu, 31 Mar 2022 14:20:43 -0700 (PDT) Received: from x1 ([2601:1c2:1001:7090:d825:f497:99ce:fdac]) by smtp.gmail.com with ESMTPSA id d18-20020a056a0010d200b004fa2e13ce80sm405829pfu.76.2022.03.31.14.20.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Mar 2022 14:20:43 -0700 (PDT) Date: Thu, 31 Mar 2022 14:21:30 -0700 From: Drew Fustini To: Tony Lindgren Subject: Re: [PATCH] iommu/omap: Fix regression in probe for NULL pointer dereference Message-ID: References: <20220331062301.24269-1-tony@atomide.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220331062301.24269-1-tony@atomide.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220331_142046_572150_29BA6B85 X-CRM114-Status: GOOD ( 20.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-omap@vger.kernel.org, Joerg Roedel , Jason Gunthorpe , iommu@lists.linux-foundation.org, Will Deacon , linux-arm-kernel@lists.infradead.org, Lu Baolu Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On TLhu, Mar 31, 2022 at 09:23:01AM +0300, Tony Lindgren wrote: > Commit 3f6634d997db ("iommu: Use right way to retrieve iommu_ops") started > triggering a NULL pointer dereference for some omap variants: > > __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/0x24 > > This is caused by omap iommu probe returning 0 instead of ERR_PTR(-ENODEV) > as noted by Jason Gunthorpe . > > Looks like the regression already happened with an earlier commit > 6785eb9105e3 ("iommu/omap: Convert to probe/release_device() call-backs") > that changed the function return type and missed converting one place. > > Cc: Drew Fustini > Cc: Lu Baolu > Cc: Suman Anna > Suggested-by: Jason Gunthorpe > Fixes: 6785eb9105e3 ("iommu/omap: Convert to probe/release_device() call-backs") > Fixes: 3f6634d997db ("iommu: Use right way to retrieve iommu_ops") > Signed-off-by: Tony Lindgren > --- > drivers/iommu/omap-iommu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c > --- a/drivers/iommu/omap-iommu.c > +++ b/drivers/iommu/omap-iommu.c > @@ -1661,7 +1661,7 @@ static struct iommu_device *omap_iommu_probe_device(struct device *dev) > num_iommus = of_property_count_elems_of_size(dev->of_node, "iommus", > sizeof(phandle)); > if (num_iommus < 0) > - return 0; > + return ERR_PTR(-ENODEV); > > arch_data = kcalloc(num_iommus + 1, sizeof(*arch_data), GFP_KERNEL); > if (!arch_data) > -- > 2.35.1 Mainline with omap2plus_defconfig now boots ok on my BeagleBoard-X15 with the TI AM5728 SoC after this patch is applied. Tested-by: Drew Fustini thanks, drew _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel