Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4803861imu; Mon, 12 Nov 2018 17:58:37 -0800 (PST) X-Google-Smtp-Source: AJdET5dFL7xAV/0H5xqVQTXiv9JCkxl6qgQ2iWPZZe4AxmyqRQ0H/Tw/rlRGH+Q2mbvF6n2VYeXb X-Received: by 2002:a63:6b08:: with SMTP id g8mr2944829pgc.119.1542074317822; Mon, 12 Nov 2018 17:58:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542074317; cv=none; d=google.com; s=arc-20160816; b=PhUphKi/ptaAudSGJ8QVTm9/fU5GyMVbdrbb7ImDpEHaw7yqeY1RUnN2Rg9AWo1Sij xV8jA2AFPaXGbCUaZtA9hUd8RAPVssuBngHy03EKx2b/6Q/t+dWkwTNnoF7DNt6MdURy uGUW44Nk5qYCATQH8gy5XPhKJukU9wvMEKlvZJU/AB/bYDkk3ZAgjiWQ4kncXrWkAXVH sXjdSLqnbjoOZwwkBT/O4kx7BQloczptPcHLzI+eWHff1FSJn0xtzye4hpK8bHHF8Ma+ p5RBvzB1vOpl7uOkIqA+4zO44ndtZl+6YcBdy3LlalO/Zut5zWKhad62JJfO/TzhCdBU VqWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=xyhICmvadfrnShpHejrsXRbuDAeIhRd9ectqbLmueZA=; b=py2uRmi3LZtulWLBjK5OZgqswJQkLxYktqe3oSKIv8XILd8dpOItpCZi8uCGGCR6p/ QJ+CGjl7025U4kjG7k7VNvH4r74eIcCo3xoADrr3XZ1wcD3dJOi4AheuC2MhOEUPvqlw 74GuvxHhTjav2xD6GdvLEJy62gKApKZwqgrFS6azhunTGe/3B5R8J1JobqPesHl3zgbz M3Ow1jD/Thilso21iZYOk+uGQTS0dcG12Wn6IeR1/yXdPZbw+2ooRYvwKt7T48YaEEZE Wwv2R6/Wq7v/EEeLO+0E+wg/z/yr8CgMa34WOL4EA/N1eDiCoUYCuWQcKQQZeJhAzQJs MtMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=iXVSsNlF; 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 f7-v6si17690232pgh.159.2018.11.12.17.58.21; Mon, 12 Nov 2018 17:58:37 -0800 (PST) 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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=iXVSsNlF; 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 S1730287AbeKMLw3 (ORCPT + 99 others); Tue, 13 Nov 2018 06:52:29 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:33568 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725991AbeKMLw3 (ORCPT ); Tue, 13 Nov 2018 06:52:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=xyhICmvadfrnShpHejrsXRbuDAeIhRd9ectqbLmueZA=; b=iXVSsNlFsAiI3I4EY907z5TGd aOIvOLQbdGrhToOPGeoryVn3DnrPvG/oqNqfIZK8Dx30KeC6Dr29RXFhGXj1aGDmZMYrRr7sKhiEO I74K7SDSKHUxA8XwkgAz0LW8vDQa5ZGJi6EYatt9h9w+nXW789bALNxTNYGyKjBgGN5ynOWxen9BS cEsesZJw0KP0jpqizcK48bJwAFBlybbApjIPVBAg9+BlnWLhCX9DxSUaev0aQhsovEAyf3ci2/4wn 7bSt/VoeK6Qju5dgIQ+ZiGZJG2N3oJeA5pWQjAq2MMzPey+ytgwkaWRNFwMWB2tvGx4TMrHgBieBl RLxZ/Dzvg==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1gMNwJ-0003Sl-Ch; Tue, 13 Nov 2018 01:56:27 +0000 Date: Mon, 12 Nov 2018 17:56:27 -0800 From: Matthew Wilcox To: Greg Kroah-Hartman Cc: Paolo Valente , Jens Axboe , Tejun Heo , Li Zefan , Angelo Ruocco , Dennis Zhou , Josef Bacik , Liu Bo , Bart Van Assche , Johannes Weiner , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, linus.walleij@linaro.org, broonie@kernel.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, Jonathan Corbet Subject: Re: [PATCH 01/12] kernfs: add function to find kernfs_node without increasing ref counter Message-ID: <20181113015627.GI21824@bombadil.infradead.org> References: <20181112095632.69114-1-paolo.valente@linaro.org> <20181112095632.69114-2-paolo.valente@linaro.org> <20181112122840.GA1429@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181112122840.GA1429@kroah.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 12, 2018 at 04:28:40AM -0800, Greg Kroah-Hartman wrote: > On Mon, Nov 12, 2018 at 10:56:21AM +0100, Paolo Valente wrote: > > From: Angelo Ruocco > > > > The kernfs pseudo file system doesn't export any function to only find > > a node by name, without also getting a reference on it. > > But in some cases it is useful to just locate a kernfs node, while > > using it or not depends on some other condition. > > > > This commit adds a function to just look for a node, without getting > > a reference on it. > > Eeek, that sounds really bad. So you save off a pointer to something, > and have no idea if that pointer now really is valid or not? It can > instantly disappear right afterwards. > > This feels wrong, what is the problem of having a properly reference > counted object passed back to you that you have to create a dangerous > function like this? I agree with Greg, this function is dangerous. What's wrong with using find_get and then doing a put once you successfully take it over, or fail to take it over?