Skip to contentSkip to conversation

pstore/ram: Avoid possible failure of dummy device unregister

PATCH In review Yue Hu 2 participants 2 messages Feb 14, 2019 Pstore filesystem

lore
Share & tools
lore

Yue Hu

author
#0 lore raw

PATCH 1/1 pstore/ram: Avoid possible failure of dummy device unregister

From 08ac260f36b4c11eb33fa58466462a5e1027bdb3 Mon Sep 17 00:00:00 2001
From: Yue Hu <[email protected]>
Date: Thu, 14 Feb 2019 19:34:16 +0800
Subject: [PATCH] pstore/ram: Avoid possible failure of dummy device unregister

If create dummy platform device failed, dummy variable should not been set as NULL. Because the following platform_device_unregister() will judge if the dummy is NULL or not, if dummy is NULL nothing happen for unregister flow.

---
 fs/pstore/ram.c | 1 -
 1 file changed, 1 deletion(-)
fs/pstore/ram.c +0 -1
index 4a06675..61bc573 100644
@@ -994,7 +994,6 @@ static void __init ramoops_register_dummy(void)
 	if (IS_ERR(dummy)) {
 		pr_info("could not create platform device: %ld\n",
 			PTR_ERR(dummy));
-		dummy = NULL;
 		ramoops_unregister_dummy();
 	}
 }
Signature · 1 line
1.9.1
#1 lore raw
Quoted 6 lines · Yue Hu

From 08ac260f36b4c11eb33fa58466462a5e1027bdb3 Mon Sep 17 00:00:00 2001
From: Yue Hu <[email protected]>
Date: Thu, 14 Feb 2019 19:34:16 +0800
Subject: [PATCH] pstore/ram: Avoid possible failure of dummy device unregister

Quoted 6 lines

If create dummy platform device failed, dummy variable should not been set as NULL. Because the following platform_device_unregister() will judge if the dummy is NULL or not, if dummy is NULL nothing happen for unregister flow.

I've gotten this email a few times today. :)

I already replied that this isn't what we want to do: we have to mark it NULL since prior to that it was an ERR_PTR, and will break the unregister.

-Kees

Quoted 19 lines
---
 fs/pstore/ram.c | 1 -
 1 file changed, 1 deletion(-)
fs/pstore/ram.c +0 -2
index 4a06675..61bc573 100644
@@ -994,7 +994,6 @@ static void __init ramoops_register_dummy(void)
        if (IS_ERR(dummy)) {
                pr_info("could not create platform device: %ld\n",
                        PTR_ERR(dummy));
-               dummy = NULL;
                ramoops_unregister_dummy();
        }
 }
--

1.9.1

Signature · 1 line
Kees Cook