Wang Shilong
2013-Dec-04 09:24 UTC
[PATCH] Btrfs-progs: fix segfault when getting scrub status
I sometimes get segfault in cmd_scrub_status(), this is because free_history() forgot to check whether pointer address is valid,fix it. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> --- cmds-scrub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmds-scrub.c b/cmds-scrub.c index 9f614bc..69791b3 100644 --- a/cmds-scrub.c +++ b/cmds-scrub.c @@ -285,7 +285,7 @@ static void print_fs_stat(struct scrub_fs_stat *fs_stat, int raw) static void free_history(struct scrub_file_record **last_scrubs) { struct scrub_file_record **l = last_scrubs; - if (!l) + if (!l || IS_ERR(l)) return; while (*l) free(*l++); -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html