btrfs: add the missing error handling inside get_canonical_dev_path
Changes
1 files changed · +4 −0
| File | Status | Add | Del | Content |
|---|---|---|---|---|
| fs/btrfs/volumes.c | modified | +4 | −0 | View file |
fs/btrfs/volumes.c
View filediff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 1cccaf9..3d0ac8b 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -797,6 +797,10 @@ static int get_canonical_dev_path(const char *dev_path, char *canonical)
if (ret)
goto out;
resolved_path = d_path(&path, path_buf, PATH_MAX);
+ if (IS_ERR(resolved_path)) {
+ ret = PTR_ERR(resolved_path);
+ goto out;
+ }
ret = strscpy(canonical, resolved_path, PATH_MAX);
out:
kfree(path_buf);