summaryrefslogtreecommitdiff
path: root/drivers/mmc/core/debugfs.c
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2017-11-21 16:42:30 +0300
committerUlf Hansson <ulf.hansson@linaro.org>2017-11-23 16:39:13 +0300
commitf9f0da98819503b06b35e61869d18cf3a8cd3323 (patch)
tree3958ac5701d4c83a9b79f27bbdb40df395aaa7db /drivers/mmc/core/debugfs.c
parentebe7dd45cf49e3b49cacbaace17f9f878f21fbea (diff)
downloadlinux-f9f0da98819503b06b35e61869d18cf3a8cd3323.tar.xz
mmc: block: Ensure that debugfs files are removed
The card is not necessarily being removed, but the debugfs files must be removed when the driver is removed, otherwise they will continue to exist after unbinding the card from the driver. e.g. # echo "mmc1:0001" > /sys/bus/mmc/drivers/mmcblk/unbind # cat /sys/kernel/debug/mmc1/mmc1\:0001/ext_csd [ 173.634584] BUG: unable to handle kernel NULL pointer dereference at 0000000000000050 [ 173.643356] IP: mmc_ext_csd_open+0x5e/0x170 A complication is that the debugfs_root may have already been removed, so check for that too. Fixes: 627c3ccfb46a ("mmc: debugfs: Move block debugfs into block module") Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Cc: stable@vger.kernel.org # 4.14+ Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/core/debugfs.c')
-rw-r--r--drivers/mmc/core/debugfs.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
index 01e459a34f33..0f4a7d7b2626 100644
--- a/drivers/mmc/core/debugfs.c
+++ b/drivers/mmc/core/debugfs.c
@@ -314,4 +314,5 @@ err:
void mmc_remove_card_debugfs(struct mmc_card *card)
{
debugfs_remove_recursive(card->debugfs_root);
+ card->debugfs_root = NULL;
}