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=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 BDFC2C48BD7 for ; Tue, 25 Jun 2019 22:56:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 91563208CA for ; Tue, 25 Jun 2019 22:56:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726401AbfFYW4L (ORCPT ); Tue, 25 Jun 2019 18:56:11 -0400 Received: from gate.crashing.org ([63.228.1.57]:48041 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725782AbfFYW4L (ORCPT ); Tue, 25 Jun 2019 18:56:11 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id x5PMu1jN032528; Tue, 25 Jun 2019 17:56:02 -0500 Message-ID: Subject: Re: [PATCH v4] driver core: Fix use-after-free and double free on glue directory From: Benjamin Herrenschmidt To: Muchun Song , Greg KH Cc: "Rafael J. Wysocki" , Prateek Sood , Mukesh Ojha , gkohli@codeaurora.org, linux-kernel , linux-arm-msm , zhaowuyun@wingtech.com Date: Wed, 26 Jun 2019 08:56:00 +1000 In-Reply-To: References: <20190516142342.28019-1-smuchun@gmail.com> <20190524190443.GB29565@kroah.com> <20190618152859.GB1912@kroah.com> <20190618161340.GA13983@kroah.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2019-06-25 at 23:06 +0800, Muchun Song wrote: > Benjamin Herrenschmidt 于2019年6月19日周三 > 上午5:51写道: > > > > On Tue, 2019-06-18 at 18:13 +0200, Greg KH wrote: > > > > > > Again, I am totally confused and do not see a patch in an email > > > that > > > I > > > can apply... > > > > > > Someone needs to get people to agree here... > > > > I think he was hoping you would chose which solution you prefered > > here > > Yeah, right, I am hoping you would chose which solution you prefered > here. > Thanks. > > > :-) His original or the one I suggested instead. I don't think > > there's > > anybody else with understanding of sysfs guts around to form an > > opinion. > > Muchun, I don't think Greg still has the previous emails. He deals with too much to keep track of old stuff. Can you send both patches tagged as [OPT1] and [OPT2] along with a comment in one go so Greg can see both and decide ? I think looking at the refcount is fragile, I might be wrong, but I think it mostly paper over the root of the problem which is the fact that the lock isn't taken accross both operations, thus exposing the race. But I'm happy if Greg prefers your approach as long as it's fixed. Cheers, Ben.