From patchwork Fri Jun 19 16:50:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 1313201 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49pPxn2Qx0zB4Cs; Sat, 20 Jun 2020 02:53:01 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1jmKG8-0000Sy-RP; Fri, 19 Jun 2020 16:52:56 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jmKEe-0007Wg-NV for kernel-team@lists.ubuntu.com; Fri, 19 Jun 2020 16:51:24 +0000 Received: from mail-il1-f198.google.com ([209.85.166.198]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jmKEc-0006SR-Hu for kernel-team@lists.ubuntu.com; Fri, 19 Jun 2020 16:51:22 +0000 Received: by mail-il1-f198.google.com with SMTP id v14so6872504ilo.19 for ; Fri, 19 Jun 2020 09:51:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hyVHJKie/5Sw3NQbB0E04ssa1p3ARWri39eh4JiTFU8=; b=duXajKs3cMVsOEEwpKhtIcYNLu7aY5uXNIDPOArJYWMSbYC58Wq8tEDXL56Kat0UJe i3MnOjk1mxbfMDB8tlofLc36n7rRsTUF57LUliM00SeEy6JT4xhOdMgNw9FfNlFblLlG 0gmB1Mh2djnv8eLNyELqPnCFHTiXjwdiF+Mi/L9/MHBKgn9Opd36JDC0fdG2LOnmJTEj I2ySRy2oV5+zl6TfIpPN5TMquM+h2LJHUlhrAXfhBPmd9JaahaBQecsfqXJqGr6IL5Hk MUXiz/VnRFtJ0MydqLyj7kp0JFn/D4/W6OSa2frjJVbVVwmmFw72jN5IQOI0XVPkKF/g K8jg== X-Gm-Message-State: AOAM5318lqgd0+phxzSjyy9aKwQL/5hPvXegu/r70nT+Y/+drTKP+wKo 212j/8ne3RCZEpNKmNoKTmOu2EGY04gUXq+gTezqFRg8yzCNQnSf0ftbvUSxxbMT0tLyoZ1gFfS 27WMGIEB9HyvKvUrNIv0rWtCfmZKFhb9ZEK8iYX+gvA== X-Received: by 2002:a6b:c992:: with SMTP id z140mr5335446iof.54.1592585481141; Fri, 19 Jun 2020 09:51:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygwEyuLkMECC8VTVZqcwghKq4kuV4VEnGLgJeja0HLB09VHDytb21cZBOl3YVz/8Y/G4l28A== X-Received: by 2002:a6b:c992:: with SMTP id z140mr5335420iof.54.1592585480832; Fri, 19 Jun 2020 09:51:20 -0700 (PDT) Received: from localhost ([2605:a601:ac0f:820:f090:1573:c2fc:6389]) by smtp.gmail.com with ESMTPSA id n7sm3362011ile.76.2020.06.19.09.51.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2020 09:51:18 -0700 (PDT) From: Seth Forshee To: kernel-team@lists.ubuntu.com Subject: [PATCH v2 54/57][X] debugfs: unproxify files created through debugfs_create_u32_array() Date: Fri, 19 Jun 2020 11:50:07 -0500 Message-Id: <20200619165010.645925-55-seth.forshee@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619165010.645925-1-seth.forshee@canonical.com> References: <20200619165010.645925-1-seth.forshee@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Nicolai Stange BugLink: https://bugs.launchpad.net/bugs/1884159 The struct file_operations u32_array_fops associated with files created through debugfs_create_u32_array() has been lifetime aware already: everything needed for subsequent operation is copied to a ->f_private buffer at file opening time in u32_array_open(). Now, ->open() is always protected against file removal issues by the debugfs core. There is no need for the debugfs core to wrap the u32_array_fops with a file lifetime managing proxy. Make debugfs_create_u32_array() create its files in non-proxying operation mode by means of debugfs_create_file_unsafe(). Signed-off-by: Nicolai Stange Signed-off-by: Greg Kroah-Hartman (cherry picked from commit c4a74f63dfd2e75e7d40a9aaa4052b0ef26e617c) Signed-off-by: Seth Forshee --- fs/debugfs/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index 2e86d66f7850..9c1c9a01b7e5 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c @@ -992,7 +992,8 @@ struct dentry *debugfs_create_u32_array(const char *name, umode_t mode, data->array = array; data->elements = elements; - return debugfs_create_file(name, mode, parent, data, &u32_array_fops); + return debugfs_create_file_unsafe(name, mode, parent, data, + &u32_array_fops); } EXPORT_SYMBOL_GPL(debugfs_create_u32_array);