Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1633783yba; Thu, 9 May 2019 21:14:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqxpP1koaLZA24aMn8bjXqHDlwJgJZfOPzAzC7EiQqhRoDp59dFGz8+towMDxWSRrDvsIn3K X-Received: by 2002:a17:902:7047:: with SMTP id h7mr10554399plt.177.1557461658090; Thu, 09 May 2019 21:14:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557461658; cv=none; d=google.com; s=arc-20160816; b=viqPHuYmlg7zZ9sS/VO7piagnEes48zzbywIM55LUkq92wEb9bcNlb2/wZ0qDJlc3r tipuNRZWRn1LJ0qBJCXrxcQ9Dm/RZXt2nbZugr52PkrDgDV3nvNRw5IC8S7bUvQyHoNH Nonygk5UsQlo/MsvQSpOUE0p5cbE5iKvRUp0KF1OXX7GNrNCqijS+/zIzv84ZDa1lWX+ CK+LZgwbUPkMJA1o+TRY7gKgvyNJqDpN/L+o23db0qu+uX0mF1MzmW9VLbooTUP9t0mI sTmTT7hxenm7Na0PWaPcqP7kAqSsBdfQGkmUrEZdwc9w8M+Cx4yz0m8iabmDQkcwqJMK l1wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature; bh=DGdY6rXlz3VtaF+3QVW7PR1AkZtS7aF2MQqZ3xdJJO8=; b=M6I5z1RE1xwqIavwQ+8x4ItdJpVRsydFn4x+BJCsdTqcwi6f1sKtRBCnGTSt3OqEje qZVXaYLFb8wreFEvaebNcD24mlPmF5NvUskrvsWUDNfyDQ2Q15RiOgT86GYlDEuk99Ox 6nhwo0EkSuHeM5tbWYvLLqqGJuDRICYIhIJMq/BkCigWCxqFGl7MgTPDjBV2l1ir/kSt ehcTFG4xxzh+XWpiMypam9ZzocOzu/SdpH++ikyhf5vhK0QrybxABo3DOLwq1um0YgKt WT3/06JpUnMOSLj0auUXbOUQ4r8TXKmWvuizjt9G8J69D4zyaQTGCpMnYhZlZGZaoMCl XAXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=eWgPmiy8; dkim=pass header.i=@codeaurora.org header.s=default header.b=IwYvbwHy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m11si6186596pgc.244.2019.05.09.21.14.00; Thu, 09 May 2019 21:14:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=eWgPmiy8; dkim=pass header.i=@codeaurora.org header.s=default header.b=IwYvbwHy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727023AbfEJDbV (ORCPT + 99 others); Thu, 9 May 2019 23:31:21 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:59128 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726882AbfEJDbU (ORCPT ); Thu, 9 May 2019 23:31:20 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id F07C4607EB; Fri, 10 May 2019 03:31:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1557459080; bh=ZdJ/UhXjQBUu2fWsqDO0l9IHAfnLU9pcY6tmqkKnt/I=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=eWgPmiy8q3KCGwv+cC+BJ7tbr7F/+kB1ksNKBz6GrsHwUjWYXd5wKBhOh2Sb7xdAn 9rjvXMrwFP+bmTzdMaObGYXHy1gONAKqfZZJlGe3JGN1Mwqm/fxaOME19CTHy6Sv29 TlpaS/Eoa/rRkGm/GXMywKmgCBnXRvSk1pkhcGVY= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from [10.204.78.109] (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: gkohli@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 86DDC60592; Fri, 10 May 2019 03:31:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1557459079; bh=ZdJ/UhXjQBUu2fWsqDO0l9IHAfnLU9pcY6tmqkKnt/I=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=IwYvbwHyjQBccR78yGpBpQQhaLwWMAnjUYY0tes3ePguKuTyPPWPHW6vzlJ7d83bU NTaVcZY5ldVw0WtlZK1QYHmZFcPUKeWf8CiqCGJbHYdCGIX5SscsO0jl/DsjGCQ7ng 8dQREHYyuK6fINknqSgt3oi3olZm5JrEyFriRmKY= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 86DDC60592 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=gkohli@codeaurora.org Subject: Re: [PATCH] driver core: Fix use-after-free and double free on glue directory To: Benjamin Herrenschmidt , Greg KH , Muchun Song Cc: rafael@kernel.org, linux-kernel , zhaowuyun@wingtech.com, linux-arm-msm@vger.kernel.org References: <20190423143258.96706-1-smuchun@gmail.com> <24b0fff3775147c04b006282727d94fea7f408b4.camel@kernel.crashing.org> <79fbc203bc9fa09d88ab2c4bff8635be4c293d49.camel@kernel.crashing.org> <20190504153440.GB19654@kroah.com> <73b783e634551420dfa249816514fb31ed3487b6.camel@kernel.crashing.org> From: Gaurav Kohli Message-ID: <6d755534-714b-5d04-3280-b27fd8a1df1b@codeaurora.org> Date: Fri, 10 May 2019 09:01:14 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <73b783e634551420dfa249816514fb31ed3487b6.camel@kernel.crashing.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks for the comment, will check the patch and update. Regards Gaurav On 5/10/2019 4:52 AM, Benjamin Herrenschmidt wrote: > On Thu, 2019-05-09 at 20:08 +0530, Gaurav Kohli wrote: >> Hi , >> >> Last patch will serialize the addition of child to parent directory, >> won't it affect performance. > > I doubt this is a significant issue, and there's already a global lock > taken once or twice in that path, the fix is purely to make sure that > the some locked section is used both for the lookup and the addition as > the bug comes from the window in between those two operations allowing > the object to be removed after it was "found". > > Cheers, > Ben. > >> >> Regards >> Gaurav >> >> On 5/4/2019 9:04 PM, Greg KH wrote: >>> On Sat, May 04, 2019 at 10:47:07PM +0800, Muchun Song wrote: >>>> Benjamin Herrenschmidt 于2019年5月2日周四 >>>> 下午2:25写道: >>>> >>>>>>> The basic idea yes, the whole bool *locked is horrid >>>>>>> though. >>>>>>> Wouldn't it >>>>>>> work to have a get_device_parent_locked that always returns >>>>>>> with >>>>>>> the mutex held, >>>>>>> or just move the mutex to the caller or something simpler >>>>>>> like this >>>>>>> ? >>>>>>> >>>>>> >>>>>> Greg and Rafael, do you have any suggestions for this? Or you >>>>>> also >>>>>> agree with Ben? >>>>> >>>>> Ping guys ? This is worth fixing... >>>> >>>> I also agree with you. But Greg and Rafael seem to be high >>>> latency right now. >>> >>> It's in my list of patches to get to, sorry, hopefully will dig out >>> of >>> that next week with the buffer that the merge window provides me. >>> >>> thanks, >>> >>> greg k-h >>> >> >> > -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.