mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2024-11-27 22:24:20 +08:00
btrfs-progs: qgroup: check null when comparing paths
This patch fixes a bug that could occur when comparing paths in showing qgroups list. Old code doesn't check it and the bug occurs when there is stale qgroup and its path is null. Check whether it is null and return without comparing paths. Issue: #687 Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Sidong Yang <realwakka@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
c1c4923a02
commit
8473ab8131
@ -486,6 +486,14 @@ static int comp_entry_with_path(struct btrfs_qgroup *entry1,
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
if (!p1) {
|
||||
ret = p2 ? 1 : 0;
|
||||
goto out;
|
||||
} else if (!p2) {
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
while (*p1 && *p2) {
|
||||
if (*p1 != *p2)
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user