[PATCH] dm: change dm_get_target_type() to check for module load error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



dm_get_target_type() doesn't check error return from request_module().
Change to check for error and return NULL instead of trying to get
target type again which would fail.

Signed-off-by: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>
---
 drivers/md/dm-target.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/md/dm-target.c b/drivers/md/dm-target.c
index 64dd0b34fcf4..0789e9f91d3a 100644
--- a/drivers/md/dm-target.c
+++ b/drivers/md/dm-target.c
@@ -41,17 +41,22 @@ static struct target_type *get_target_type(const char *name)
 	return tt;
 }
 
-static void load_module(const char *name)
+static int load_module(const char *name)
 {
-	request_module("dm-%s", name);
+	return request_module("dm-%s", name);
 }
 
 struct target_type *dm_get_target_type(const char *name)
 {
 	struct target_type *tt = get_target_type(name);
+	int ret;
 
 	if (!tt) {
-		load_module(name);
+		ret = load_module(name);
+		if (ret < 0) {
+			pr_err("Module %s load failed %d\n", name, ret);
+			return NULL;
+		}
 		tt = get_target_type(name);
 	}
 
-- 
2.30.2

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux