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 X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA2F2C56202 for ; Wed, 25 Nov 2020 01:54:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A111C20BED for ; Wed, 25 Nov 2020 01:54:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726733AbgKYByw (ORCPT ); Tue, 24 Nov 2020 20:54:52 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:7730 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726298AbgKYByw (ORCPT ); Tue, 24 Nov 2020 20:54:52 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4CgkTL0NZBzkfXG; Wed, 25 Nov 2020 09:54:14 +0800 (CST) Received: from [10.174.178.174] (10.174.178.174) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Wed, 25 Nov 2020 09:54:35 +0800 Subject: Re: [PATCH] iommu: fix return error code in iommu_probe_device() To: Will Deacon CC: Lu Baolu , , References: <20201117025238.3425422-1-yangyingliang@huawei.com> <835ab066-b6b8-a211-4941-c01781031de8@linux.intel.com> <454f5e3e-c380-e8a5-9283-3f7578eb601e@huawei.com> <20201117224102.GD524@willie-the-truck> From: Yang Yingliang Message-ID: <78bee047-ab33-4d81-6f77-af4c5b6e8aaa@huawei.com> Date: Wed, 25 Nov 2020 09:54:34 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20201117224102.GD524@willie-the-truck> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [10.174.178.174] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/11/18 6:41, Will Deacon wrote: > On Tue, Nov 17, 2020 at 07:11:28PM +0800, Yang Yingliang wrote: >> On 2020/11/17 17:40, Lu Baolu wrote: >>> On 2020/11/17 10:52, Yang Yingliang wrote: >>>> If iommu_group_get() failed, it need return error code >>>> in iommu_probe_device(). >>>> >>>> Fixes: cf193888bfbd ("iommu: Move new probe_device path...") >>>> Reported-by: Hulk Robot >>>> Signed-off-by: Yang Yingliang >>>> --- >>>>   drivers/iommu/iommu.c | 4 +++- >>>>   1 file changed, 3 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c >>>> index b53446bb8c6b..6f4a32df90f6 100644 >>>> --- a/drivers/iommu/iommu.c >>>> +++ b/drivers/iommu/iommu.c >>>> @@ -253,8 +253,10 @@ int iommu_probe_device(struct device *dev) >>>>           goto err_out; >>>>         group = iommu_group_get(dev); >>>> -    if (!group) >>>> +    if (!group) { >>>> +        ret = -ENODEV; >>> Can you please explain why you use -ENODEV here? >> Before 79659190ee97 ("iommu: Don't take group reference in >> iommu_alloc_default_domain()"), in >> >> iommu_alloc_default_domain(), if group is NULL, it will return -ENODEV. > Hmm. While I think the patch is ok, I'm not sure it qualifies as a fix. > Has iommu_probe_device() ever propagated this error? The commit you > identify in the 'Fixes:' tag doesn't seem to change this afaict. I think after this commit 439945e74a4b ("iommu: Move default domain allocation to iommu_probe_device()"), iommu_probe_device() won't return error code if group is NULL. I can add this fix tag in v2. > > Will > .