Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1726630imm; Sat, 16 Jun 2018 01:38:42 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJbRMMlxGdCCwyVrMEnrQsS8F+qKbYIGFVFzJ9u0LTXGGyLvoh8FpSasZ37g5ZMyx21gb8b X-Received: by 2002:a17:902:2924:: with SMTP id g33-v6mr5867995plb.26.1529138322039; Sat, 16 Jun 2018 01:38:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529138322; cv=none; d=google.com; s=arc-20160816; b=yaouyK/yIlEtz2sGJKQRg3BJBlaq2uT6+IPYyN2lFRnVrXeGdzzr4iujQnOl025nK6 j6Nc9ab+lK46HRVEh+qQtEVsnt2rQz2JgMc+UpfpF+7qQrS9THGcjxChe8pKAgDA9U1C q21OOpInNi7+/bFCyRxx42Ugs/jDRTMEgvX5YecL8/rAY2QaSsMbv9YQmloNd6TOykKk cslBjtfNbhosl2GLKg3gHfyWtEZnFUFLZ7g8gTRKFy2MsTn3bk2pYuGrGbWNHWNJj77Y bccj/fRJbmGdYViHJ6VTk2PahbyiDkUorVPH73ttFVIlLqQtTP1D7drph2ivjTz5yCtO ZNHQ== 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:arc-authentication-results; bh=idw+AJKle/1aTb+PwN025dD45c48wbSfL8TWN6R6rWo=; b=wzSUG3Q6puoF6s6LlnMJ6HdTXzcBlwoTP7dcOOkxEYv9rvhyFHqKu7cHzBbmrbYLRh tb6AerFWOok6GSrNlZRyiVMcamNgLSWJoGUraCz4HG2M8Kcc2a5HBJBXGxFULaElwUMW 6C0Xp010oM6XchUDQw8wZMnvONacYb9BCMz2WuzIZGcKyhAbbs40jP/sD/Q49xm84yTo O6g1s28EwHCswXqEB2FtIdKwks45jLGvRFG4WLrec9p1OWVY5L45VgTR5LYOu9RyDc4t hAWAZ4eWOIvynxtoXAoIP+xC3f4++Qcto1+HHBAGAiARIv0TKjBJHLojH8oeIL5qqVs2 EGNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rQdDsmDh; 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 s36-v6si9613564pld.278.2018.06.16.01.38.26; Sat, 16 Jun 2018 01:38:42 -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=@kernel.org header.s=default header.b=rQdDsmDh; 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 S934329AbeFPIiF (ORCPT + 99 others); Sat, 16 Jun 2018 04:38:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:48796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932376AbeFPIiD (ORCPT ); Sat, 16 Jun 2018 04:38:03 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EA8DA20896; Sat, 16 Jun 2018 08:38:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1529138283; bh=2rIa9GJ3pMpoYd9V7rWpQ9MPpx4nFPNMFbxP5Zz2qUI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rQdDsmDhFA4yYw0YTBVEyYJBBEWIgLnYVWU71yI36aF2wkKYAEtt437RcT7KsBc6b /dd6kYjRdk4jOSOnl/UHALydGmRDmLiQnUtzgQDQJs8ERgAWuScf8Tf6/o89AQ31Xh gCLt1I6kUEYIf9OHhe+ovf2xUU8I/uf03n8nbxCQ= Date: Sat, 16 Jun 2018 10:37:40 +0200 From: Greg Kroah-Hartman To: Rajat Jain Cc: linux-kernel@vger.kernel.org, rajatxjain@gmail.com Subject: Re: [PATCH v2] sysfs: Fix internal_create_group() for named group updates Message-ID: <20180616083740.GA23039@kroah.com> References: <20180616081837.62730-1-rajatja@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180616081837.62730-1-rajatja@google.com> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 16, 2018 at 01:18:37AM -0700, Rajat Jain wrote: > There are a couple of problems with named group updates in the code > today: > > * sysfs_update_group() will always fail for a named group, because > internal_create_group() will try to create a new sysfs directory > unconditionally, which will ofcourse fail with -EEXIST. > > * We can leak the kernfs_node for grp->name if some one tries to: > - rename a group (change grp->name), or > - update a named group, to an unnamed group > > It appears that the whole purpose of sysfs_update_group() was to > allow changing the permissions or visibility of attributes and not > the names. So make it clear in the comments, and allow it to update > an existing named group. > > Signed-off-by: Rajat Jain > --- > v2: Use pr_warn() instead of WARN() Looks good, I'll queue it up after 4.18-rc1 is out, thanks for the update so quickly. greg k-h