]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Dec 2020 08:35:14 +0000 (09:35 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Dec 2020 08:35:14 +0000 (09:35 +0100)
added patches:
usb-core-add-endpoint-blacklist-quirk.patch
usb-core-fix-regression-in-hercules-audio-card.patch
x86-resctrl-add-necessary-kernfs_put-calls-to-prevent-refcount-leak.patch
x86-resctrl-remove-superfluous-kernfs_get-calls-to-prevent-refcount-leak.patch

queue-4.14/series
queue-4.14/usb-core-add-endpoint-blacklist-quirk.patch [new file with mode: 0644]
queue-4.14/usb-core-fix-regression-in-hercules-audio-card.patch [new file with mode: 0644]
queue-4.14/x86-resctrl-add-necessary-kernfs_put-calls-to-prevent-refcount-leak.patch [new file with mode: 0644]
queue-4.14/x86-resctrl-remove-superfluous-kernfs_get-calls-to-prevent-refcount-leak.patch [new file with mode: 0644]

index aeb00b6db32033cba78d315efb694feceabe2398..42809c020c991c8778a768f7ebf6d28d025ba95d 100644 (file)
@@ -45,3 +45,7 @@ usb-core-change-pk-for-__user-pointers-to-px.patch
 usb-gadget-f_midi-fix-memleak-in-f_midi_alloc.patch
 usb-gadget-fix-memleak-in-gadgetfs_fill_super.patch
 x86-speculation-fix-prctl-when-spectre_v2_user-seccomp-prctl-ibpb.patch
+x86-resctrl-remove-superfluous-kernfs_get-calls-to-prevent-refcount-leak.patch
+x86-resctrl-add-necessary-kernfs_put-calls-to-prevent-refcount-leak.patch
+usb-core-add-endpoint-blacklist-quirk.patch
+usb-core-fix-regression-in-hercules-audio-card.patch
diff --git a/queue-4.14/usb-core-add-endpoint-blacklist-quirk.patch b/queue-4.14/usb-core-add-endpoint-blacklist-quirk.patch
new file mode 100644 (file)
index 0000000..e2bb1b2
--- /dev/null
@@ -0,0 +1,124 @@
+From foo@baz Tue Dec  1 09:31:05 AM CET 2020
+From: Johan Hovold <johan@kernel.org>
+Date: Mon, 3 Feb 2020 16:38:28 +0100
+Subject: USB: core: add endpoint-blacklist quirk
+
+From: Johan Hovold <johan@kernel.org>
+
+commit 73f8bda9b5dc1c69df2bc55c0cbb24461a6391a9 upstream
+
+Add a new device quirk that can be used to blacklist endpoints.
+
+Since commit 3e4f8e21c4f2 ("USB: core: fix check for duplicate
+endpoints") USB core ignores any duplicate endpoints found during
+descriptor parsing.
+
+In order to handle devices where the first interfaces with duplicate
+endpoints are the ones that should have their endpoints ignored, we need
+to add a blacklist.
+
+Tested-by: edes <edes@gmx.net>
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Link: https://lore.kernel.org/r/20200203153830.26394-2-johan@kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+[sudip: adjust context]
+Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/core/config.c  |   11 +++++++++++
+ drivers/usb/core/quirks.c  |   32 ++++++++++++++++++++++++++++++++
+ drivers/usb/core/usb.h     |    3 +++
+ include/linux/usb/quirks.h |    3 +++
+ 4 files changed, 49 insertions(+)
+
+--- a/drivers/usb/core/config.c
++++ b/drivers/usb/core/config.c
+@@ -256,6 +256,7 @@ static int usb_parse_endpoint(struct dev
+               struct usb_host_interface *ifp, int num_ep,
+               unsigned char *buffer, int size)
+ {
++      struct usb_device *udev = to_usb_device(ddev);
+       unsigned char *buffer0 = buffer;
+       struct usb_endpoint_descriptor *d;
+       struct usb_host_endpoint *endpoint;
+@@ -297,6 +298,16 @@ static int usb_parse_endpoint(struct dev
+               goto skip_to_next_endpoint_or_interface_descriptor;
+       }
++      /* Ignore blacklisted endpoints */
++      if (udev->quirks & USB_QUIRK_ENDPOINT_BLACKLIST) {
++              if (usb_endpoint_is_blacklisted(udev, ifp, d)) {
++                      dev_warn(ddev, "config %d interface %d altsetting %d has a blacklisted endpoint with address 0x%X, skipping\n",
++                                      cfgno, inum, asnum,
++                                      d->bEndpointAddress);
++                      goto skip_to_next_endpoint_or_interface_descriptor;
++              }
++      }
++
+       endpoint = &ifp->endpoint[ifp->desc.bNumEndpoints];
+       ++ifp->desc.bNumEndpoints;
+--- a/drivers/usb/core/quirks.c
++++ b/drivers/usb/core/quirks.c
+@@ -344,6 +344,38 @@ static const struct usb_device_id usb_am
+       { }  /* terminating entry must be last */
+ };
++/*
++ * Entries for blacklisted endpoints that should be ignored when parsing
++ * configuration descriptors.
++ *
++ * Matched for devices with USB_QUIRK_ENDPOINT_BLACKLIST.
++ */
++static const struct usb_device_id usb_endpoint_blacklist[] = {
++      { }
++};
++
++bool usb_endpoint_is_blacklisted(struct usb_device *udev,
++              struct usb_host_interface *intf,
++              struct usb_endpoint_descriptor *epd)
++{
++      const struct usb_device_id *id;
++      unsigned int address;
++
++      for (id = usb_endpoint_blacklist; id->match_flags; ++id) {
++              if (!usb_match_device(udev, id))
++                      continue;
++
++              if (!usb_match_one_id_intf(udev, intf, id))
++                      continue;
++
++              address = id->driver_info;
++              if (address == epd->bEndpointAddress)
++                      return true;
++      }
++
++      return false;
++}
++
+ static bool usb_match_any_interface(struct usb_device *udev,
+                                   const struct usb_device_id *id)
+ {
+--- a/drivers/usb/core/usb.h
++++ b/drivers/usb/core/usb.h
+@@ -36,6 +36,9 @@ extern void usb_deauthorize_interface(st
+ extern void usb_authorize_interface(struct usb_interface *);
+ extern void usb_detect_quirks(struct usb_device *udev);
+ extern void usb_detect_interface_quirks(struct usb_device *udev);
++extern bool usb_endpoint_is_blacklisted(struct usb_device *udev,
++              struct usb_host_interface *intf,
++              struct usb_endpoint_descriptor *epd);
+ extern int usb_remove_device(struct usb_device *udev);
+ extern int usb_get_device_descriptor(struct usb_device *dev,
+--- a/include/linux/usb/quirks.h
++++ b/include/linux/usb/quirks.h
+@@ -60,4 +60,7 @@
+ /* Device needs a pause after every control message. */
+ #define USB_QUIRK_DELAY_CTRL_MSG              BIT(13)
++/* device has blacklisted endpoints */
++#define USB_QUIRK_ENDPOINT_BLACKLIST          BIT(15)
++
+ #endif /* __LINUX_USB_QUIRKS_H */
diff --git a/queue-4.14/usb-core-fix-regression-in-hercules-audio-card.patch b/queue-4.14/usb-core-fix-regression-in-hercules-audio-card.patch
new file mode 100644 (file)
index 0000000..e288ff0
--- /dev/null
@@ -0,0 +1,57 @@
+From foo@baz Tue Dec  1 09:31:05 AM CET 2020
+From: Alan Stern <stern@rowland.harvard.edu>
+Date: Thu, 19 Nov 2020 12:00:40 -0500
+Subject: USB: core: Fix regression in Hercules audio card
+
+From: Alan Stern <stern@rowland.harvard.edu>
+
+commit 184eead057cc7e803558269babc1f2cfb9113ad1 upstream
+
+Commit 3e4f8e21c4f2 ("USB: core: fix check for duplicate endpoints")
+aimed to make the USB stack more reliable by detecting and skipping
+over endpoints that are duplicated between interfaces.  This caused a
+regression for a Hercules audio card (reported as Bugzilla #208357),
+which contains such non-compliant duplications.  Although the
+duplications are harmless, skipping the valid endpoints prevented the
+device from working.
+
+This patch fixes the regression by adding ENDPOINT_IGNORE quirks for
+the Hercules card, telling the kernel to ignore the invalid duplicate
+endpoints and thereby allowing the valid endpoints to be used as
+intended.
+
+Fixes: 3e4f8e21c4f2 ("USB: core: fix check for duplicate endpoints")
+CC: <stable@vger.kernel.org>
+Reported-by: Alexander Chalikiopoulos <bugzilla.kernel.org@mrtoasted.com>
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+Link: https://lore.kernel.org/r/20201119170040.GA576844@rowland.harvard.edu
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+[sudip: use usb_endpoint_blacklist and USB_QUIRK_ENDPOINT_BLACKLIST]
+Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/core/quirks.c |    6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/usb/core/quirks.c
++++ b/drivers/usb/core/quirks.c
+@@ -195,6 +195,10 @@ static const struct usb_device_id usb_qu
+       /* Guillemot Webcam Hercules Dualpix Exchange*/
+       { USB_DEVICE(0x06f8, 0x3005), .driver_info = USB_QUIRK_RESET_RESUME },
++      /* Guillemot Hercules DJ Console audio card (BZ 208357) */
++      { USB_DEVICE(0x06f8, 0xb000), .driver_info =
++                      USB_QUIRK_ENDPOINT_BLACKLIST },
++
+       /* Midiman M-Audio Keystation 88es */
+       { USB_DEVICE(0x0763, 0x0192), .driver_info = USB_QUIRK_RESET_RESUME },
+@@ -351,6 +355,8 @@ static const struct usb_device_id usb_am
+  * Matched for devices with USB_QUIRK_ENDPOINT_BLACKLIST.
+  */
+ static const struct usb_device_id usb_endpoint_blacklist[] = {
++      { USB_DEVICE_INTERFACE_NUMBER(0x06f8, 0xb000, 5), .driver_info = 0x01 },
++      { USB_DEVICE_INTERFACE_NUMBER(0x06f8, 0xb000, 5), .driver_info = 0x81 },
+       { }
+ };
diff --git a/queue-4.14/x86-resctrl-add-necessary-kernfs_put-calls-to-prevent-refcount-leak.patch b/queue-4.14/x86-resctrl-add-necessary-kernfs_put-calls-to-prevent-refcount-leak.patch
new file mode 100644 (file)
index 0000000..a184911
--- /dev/null
@@ -0,0 +1,170 @@
+From foo@baz Tue Dec  1 09:26:19 AM CET 2020
+From: Xiaochen Shen <xiaochen.shen@intel.com>
+Date: Tue,  1 Dec 2020 01:28:49 +0800
+Subject: x86/resctrl: Add necessary kernfs_put() calls to prevent refcount leak
+To: stable@vger.kernel.org, gregkh@linuxfoundation.org, sashal@kernel.org, bp@suse.de, reinette.chatre@intel.com, willemb@google.com
+Cc: tony.luck@intel.com, fenghua.yu@intel.com, pei.p.jia@intel.com, xiaochen.shen@intel.com
+Message-ID: <1606757329-9818-1-git-send-email-xiaochen.shen@intel.com>
+
+From: Xiaochen Shen <xiaochen.shen@intel.com>
+
+commit 758999246965eeb8b253d47e72f7bfe508804b16 upstream.
+
+On resource group creation via a mkdir an extra kernfs_node reference is
+obtained by kernfs_get() to ensure that the rdtgroup structure remains
+accessible for the rdtgroup_kn_unlock() calls where it is removed on
+deletion. Currently the extra kernfs_node reference count is only
+dropped by kernfs_put() in rdtgroup_kn_unlock() while the rdtgroup
+structure is removed in a few other locations that lack the matching
+reference drop.
+
+In call paths of rmdir and umount, when a control group is removed,
+kernfs_remove() is called to remove the whole kernfs nodes tree of the
+control group (including the kernfs nodes trees of all child monitoring
+groups), and then rdtgroup structure is freed by kfree(). The rdtgroup
+structures of all child monitoring groups under the control group are
+freed by kfree() in free_all_child_rdtgrp().
+
+Before calling kfree() to free the rdtgroup structures, the kernfs node
+of the control group itself as well as the kernfs nodes of all child
+monitoring groups still take the extra references which will never be
+dropped to 0 and the kernfs nodes will never be freed. It leads to
+reference count leak and kernfs_node_cache memory leak.
+
+For example, reference count leak is observed in these two cases:
+  (1) mount -t resctrl resctrl /sys/fs/resctrl
+      mkdir /sys/fs/resctrl/c1
+      mkdir /sys/fs/resctrl/c1/mon_groups/m1
+      umount /sys/fs/resctrl
+
+  (2) mkdir /sys/fs/resctrl/c1
+      mkdir /sys/fs/resctrl/c1/mon_groups/m1
+      rmdir /sys/fs/resctrl/c1
+
+The same reference count leak issue also exists in the error exit paths
+of mkdir in mkdir_rdt_prepare() and rdtgroup_mkdir_ctrl_mon().
+
+Fix this issue by following changes to make sure the extra kernfs_node
+reference on rdtgroup is dropped before freeing the rdtgroup structure.
+  (1) Introduce rdtgroup removal helper rdtgroup_remove() to wrap up
+  kernfs_put() and kfree().
+
+  (2) Call rdtgroup_remove() in rdtgroup removal path where the rdtgroup
+  structure is about to be freed by kfree().
+
+  (3) Call rdtgroup_remove() or kernfs_put() as appropriate in the error
+  exit paths of mkdir where an extra reference is taken by kernfs_get().
+
+Backporting notes:
+
+Since upstream commit fa7d949337cc ("x86/resctrl: Rename and move rdt
+files to a separate directory"), the file
+arch/x86/kernel/cpu/intel_rdt_rdtgroup.c has been renamed and moved to
+arch/x86/kernel/cpu/resctrl/rdtgroup.c.
+Apply the change against file arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+in older stable trees.
+
+Fixes: f3cbeacaa06e ("x86/intel_rdt/cqm: Add rmdir support")
+Fixes: e02737d5b826 ("x86/intel_rdt: Add tasks files")
+Fixes: 60cf5e101fd4 ("x86/intel_rdt: Add mkdir to resctrl file system")
+Reported-by: Willem de Bruijn <willemb@google.com>
+Signed-off-by: Xiaochen Shen <xiaochen.shen@intel.com>
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
+Cc: stable@vger.kernel.org
+Link: https://lkml.kernel.org/r/1604085088-31707-1-git-send-email-xiaochen.shen@intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kernel/cpu/intel_rdt_rdtgroup.c |   32 ++++++++++++++++++++++++-------
+ 1 file changed, 25 insertions(+), 7 deletions(-)
+
+--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
++++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+@@ -393,6 +393,24 @@ unlock:
+       return ret ?: nbytes;
+ }
++/**
++ * rdtgroup_remove - the helper to remove resource group safely
++ * @rdtgrp: resource group to remove
++ *
++ * On resource group creation via a mkdir, an extra kernfs_node reference is
++ * taken to ensure that the rdtgroup structure remains accessible for the
++ * rdtgroup_kn_unlock() calls where it is removed.
++ *
++ * Drop the extra reference here, then free the rdtgroup structure.
++ *
++ * Return: void
++ */
++static void rdtgroup_remove(struct rdtgroup *rdtgrp)
++{
++      kernfs_put(rdtgrp->kn);
++      kfree(rdtgrp);
++}
++
+ struct task_move_callback {
+       struct callback_head    work;
+       struct rdtgroup         *rdtgrp;
+@@ -415,7 +433,7 @@ static void move_myself(struct callback_
+           (rdtgrp->flags & RDT_DELETED)) {
+               current->closid = 0;
+               current->rmid = 0;
+-              kfree(rdtgrp);
++              rdtgroup_remove(rdtgrp);
+       }
+       preempt_disable();
+@@ -1112,8 +1130,7 @@ void rdtgroup_kn_unlock(struct kernfs_no
+       if (atomic_dec_and_test(&rdtgrp->waitcount) &&
+           (rdtgrp->flags & RDT_DELETED)) {
+               kernfs_unbreak_active_protection(kn);
+-              kernfs_put(rdtgrp->kn);
+-              kfree(rdtgrp);
++              rdtgroup_remove(rdtgrp);
+       } else {
+               kernfs_unbreak_active_protection(kn);
+       }
+@@ -1313,7 +1330,7 @@ static void free_all_child_rdtgrp(struct
+               if (atomic_read(&sentry->waitcount) != 0)
+                       sentry->flags = RDT_DELETED;
+               else
+-                      kfree(sentry);
++                      rdtgroup_remove(sentry);
+       }
+ }
+@@ -1351,7 +1368,7 @@ static void rmdir_all_sub(void)
+               if (atomic_read(&rdtgrp->waitcount) != 0)
+                       rdtgrp->flags = RDT_DELETED;
+               else
+-                      kfree(rdtgrp);
++                      rdtgroup_remove(rdtgrp);
+       }
+       /* Notify online CPUs to update per cpu storage and PQR_ASSOC MSR */
+       update_closid_rmid(cpu_online_mask, &rdtgroup_default);
+@@ -1606,7 +1623,7 @@ static int mkdir_rdt_prepare(struct kern
+        * kernfs_remove() will drop the reference count on "kn" which
+        * will free it. But we still need it to stick around for the
+        * rdtgroup_kn_unlock(kn) call. Take one extra reference here,
+-       * which will be dropped inside rdtgroup_kn_unlock().
++       * which will be dropped by kernfs_put() in rdtgroup_remove().
+        */
+       kernfs_get(kn);
+@@ -1640,6 +1657,7 @@ static int mkdir_rdt_prepare(struct kern
+ out_idfree:
+       free_rmid(rdtgrp->mon.rmid);
+ out_destroy:
++      kernfs_put(rdtgrp->kn);
+       kernfs_remove(rdtgrp->kn);
+ out_free_rgrp:
+       kfree(rdtgrp);
+@@ -1652,7 +1670,7 @@ static void mkdir_rdt_prepare_clean(stru
+ {
+       kernfs_remove(rgrp->kn);
+       free_rmid(rgrp->mon.rmid);
+-      kfree(rgrp);
++      rdtgroup_remove(rgrp);
+ }
+ /*
diff --git a/queue-4.14/x86-resctrl-remove-superfluous-kernfs_get-calls-to-prevent-refcount-leak.patch b/queue-4.14/x86-resctrl-remove-superfluous-kernfs_get-calls-to-prevent-refcount-leak.patch
new file mode 100644 (file)
index 0000000..9eae246
--- /dev/null
@@ -0,0 +1,185 @@
+From foo@baz Tue Dec  1 09:26:19 AM CET 2020
+From: Xiaochen Shen <xiaochen.shen@intel.com>
+Date: Tue,  1 Dec 2020 01:27:08 +0800
+Subject: x86/resctrl: Remove superfluous kernfs_get() calls to prevent refcount leak
+To: stable@vger.kernel.org, gregkh@linuxfoundation.org, sashal@kernel.org, bp@suse.de, reinette.chatre@intel.com, willemb@google.com
+Cc: tony.luck@intel.com, fenghua.yu@intel.com, pei.p.jia@intel.com, xiaochen.shen@intel.com
+Message-ID: <1606757228-9555-1-git-send-email-xiaochen.shen@intel.com>
+
+From: Xiaochen Shen <xiaochen.shen@intel.com>
+
+commit fd8d9db3559a29fd737bcdb7c4fcbe1940caae34 upstream.
+
+Willem reported growing of kernfs_node_cache entries in slabtop when
+repeatedly creating and removing resctrl subdirectories as well as when
+repeatedly mounting and unmounting the resctrl filesystem.
+
+On resource group (control as well as monitoring) creation via a mkdir
+an extra kernfs_node reference is obtained to ensure that the rdtgroup
+structure remains accessible for the rdtgroup_kn_unlock() calls where it
+is removed on deletion. The kernfs_node reference count is dropped by
+kernfs_put() in rdtgroup_kn_unlock().
+
+With the above explaining the need for one kernfs_get()/kernfs_put()
+pair in resctrl there are more places where a kernfs_node reference is
+obtained without a corresponding release. The excessive amount of
+reference count on kernfs nodes will never be dropped to 0 and the
+kernfs nodes will never be freed in the call paths of rmdir and umount.
+It leads to reference count leak and kernfs_node_cache memory leak.
+
+Remove the superfluous kernfs_get() calls and expand the existing
+comments surrounding the remaining kernfs_get()/kernfs_put() pair that
+remains in use.
+
+Superfluous kernfs_get() calls are removed from two areas:
+
+  (1) In call paths of mount and mkdir, when kernfs nodes for "info",
+  "mon_groups" and "mon_data" directories and sub-directories are
+  created, the reference count of newly created kernfs node is set to 1.
+  But after kernfs_create_dir() returns, superfluous kernfs_get() are
+  called to take an additional reference.
+
+  (2) kernfs_get() calls in rmdir call paths.
+
+Backporting notes:
+
+Since upstream commit fa7d949337cc ("x86/resctrl: Rename and move rdt
+files to a separate directory"), the file
+arch/x86/kernel/cpu/intel_rdt_rdtgroup.c has been renamed and moved to
+arch/x86/kernel/cpu/resctrl/rdtgroup.c.
+Apply the change against file arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+for older stable trees.
+
+Upstream commit 17eafd076291 ("x86/intel_rdt: Split resource group
+removal in two") moved part of resource group removal code from
+rdtgroup_rmdir_ctrl() into a separate function rdtgroup_ctrl_remove().
+Apply the change against original code base of rdtgroup_rmdir_ctrl() for
+older stable trees.
+
+Fixes: 17eafd076291 ("x86/intel_rdt: Split resource group removal in two")
+Fixes: 4af4a88e0c92 ("x86/intel_rdt/cqm: Add mount,umount support")
+Fixes: f3cbeacaa06e ("x86/intel_rdt/cqm: Add rmdir support")
+Fixes: d89b7379015f ("x86/intel_rdt/cqm: Add mon_data")
+Fixes: c7d9aac61311 ("x86/intel_rdt/cqm: Add mkdir support for RDT monitoring")
+Fixes: 5dc1d5c6bac2 ("x86/intel_rdt: Simplify info and base file lists")
+Fixes: 60cf5e101fd4 ("x86/intel_rdt: Add mkdir to resctrl file system")
+Fixes: 4e978d06dedb ("x86/intel_rdt: Add "info" files to resctrl file system")
+Reported-by: Willem de Bruijn <willemb@google.com>
+Signed-off-by: Xiaochen Shen <xiaochen.shen@intel.com>
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
+Tested-by: Willem de Bruijn <willemb@google.com>
+Cc: stable@vger.kernel.org
+Link: https://lkml.kernel.org/r/1604085053-31639-1-git-send-email-xiaochen.shen@intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kernel/cpu/intel_rdt_rdtgroup.c |   35 +------------------------------
+ 1 file changed, 2 insertions(+), 33 deletions(-)
+
+--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
++++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+@@ -830,7 +830,6 @@ static int rdtgroup_mkdir_info_resdir(st
+       if (IS_ERR(kn_subdir))
+               return PTR_ERR(kn_subdir);
+-      kernfs_get(kn_subdir);
+       ret = rdtgroup_kn_set_ugid(kn_subdir);
+       if (ret)
+               return ret;
+@@ -853,7 +852,6 @@ static int rdtgroup_create_info_dir(stru
+       kn_info = kernfs_create_dir(parent_kn, "info", parent_kn->mode, NULL);
+       if (IS_ERR(kn_info))
+               return PTR_ERR(kn_info);
+-      kernfs_get(kn_info);
+       for_each_alloc_enabled_rdt_resource(r) {
+               fflags =  r->fflags | RF_CTRL_INFO;
+@@ -870,12 +868,6 @@ static int rdtgroup_create_info_dir(stru
+                       goto out_destroy;
+       }
+-      /*
+-       * This extra ref will be put in kernfs_remove() and guarantees
+-       * that @rdtgrp->kn is always accessible.
+-       */
+-      kernfs_get(kn_info);
+-
+       ret = rdtgroup_kn_set_ugid(kn_info);
+       if (ret)
+               goto out_destroy;
+@@ -904,12 +896,6 @@ mongroup_create_dir(struct kernfs_node *
+       if (dest_kn)
+               *dest_kn = kn;
+-      /*
+-       * This extra ref will be put in kernfs_remove() and guarantees
+-       * that @rdtgrp->kn is always accessible.
+-       */
+-      kernfs_get(kn);
+-
+       ret = rdtgroup_kn_set_ugid(kn);
+       if (ret)
+               goto out_destroy;
+@@ -1178,7 +1164,6 @@ static struct dentry *rdt_mount(struct f
+                       dentry = ERR_PTR(ret);
+                       goto out_info;
+               }
+-              kernfs_get(kn_mongrp);
+               ret = mkdir_mondata_all(rdtgroup_default.kn,
+                                       &rdtgroup_default, &kn_mondata);
+@@ -1186,7 +1171,6 @@ static struct dentry *rdt_mount(struct f
+                       dentry = ERR_PTR(ret);
+                       goto out_mongrp;
+               }
+-              kernfs_get(kn_mondata);
+               rdtgroup_default.mon.mon_data_kn = kn_mondata;
+       }
+@@ -1461,11 +1445,6 @@ static int mkdir_mondata_subdir(struct k
+       if (IS_ERR(kn))
+               return PTR_ERR(kn);
+-      /*
+-       * This extra ref will be put in kernfs_remove() and guarantees
+-       * that kn is always accessible.
+-       */
+-      kernfs_get(kn);
+       ret = rdtgroup_kn_set_ugid(kn);
+       if (ret)
+               goto out_destroy;
+@@ -1626,8 +1605,8 @@ static int mkdir_rdt_prepare(struct kern
+       /*
+        * kernfs_remove() will drop the reference count on "kn" which
+        * will free it. But we still need it to stick around for the
+-       * rdtgroup_kn_unlock(kn} call below. Take one extra reference
+-       * here, which will be dropped inside rdtgroup_kn_unlock().
++       * rdtgroup_kn_unlock(kn) call. Take one extra reference here,
++       * which will be dropped inside rdtgroup_kn_unlock().
+        */
+       kernfs_get(kn);
+@@ -1839,11 +1818,6 @@ static int rdtgroup_rmdir_mon(struct ker
+       WARN_ON(list_empty(&prdtgrp->mon.crdtgrp_list));
+       list_del(&rdtgrp->mon.crdtgrp_list);
+-      /*
+-       * one extra hold on this, will drop when we kfree(rdtgrp)
+-       * in rdtgroup_kn_unlock()
+-       */
+-      kernfs_get(kn);
+       kernfs_remove(rdtgrp->kn);
+       return 0;
+@@ -1880,11 +1854,6 @@ static int rdtgroup_rmdir_ctrl(struct ke
+       list_del(&rdtgrp->rdtgroup_list);
+-      /*
+-       * one extra hold on this, will drop when we kfree(rdtgrp)
+-       * in rdtgroup_kn_unlock()
+-       */
+-      kernfs_get(kn);
+       kernfs_remove(rdtgrp->kn);
+       /*