quota: Remove BUG_ON in dquot_load_quota_sb()
authorJan Kara <jack@suse.cz>
Fri, 20 Oct 2023 11:23:51 +0000 (13:23 +0200)
committerJan Kara <jack@suse.cz>
Mon, 22 Jan 2024 11:56:20 +0000 (12:56 +0100)
The case when someone passes DQUOT_SUSPENDED flag to
dquot_load_quota_sb() is easy to handle. So just WARN_ON_ONCE and bail
with error if that happens instead of calling BUG_ON which is likely to
lockup the machine.

Signed-off-by: Jan Kara <jack@suse.cz>
fs/quota/dquot.c

index d863d6b1ff97de7cb8f4a6b131482fd5802f882d..85edbbafaaa42b99fb001a38a5697f43d07643a7 100644 (file)
@@ -2385,7 +2385,8 @@ int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
        lockdep_assert_held_write(&sb->s_umount);
 
        /* Just unsuspend quotas? */
-       BUG_ON(flags & DQUOT_SUSPENDED);
+       if (WARN_ON_ONCE(flags & DQUOT_SUSPENDED))
+               return -EINVAL;
 
        if (!fmt)
                return -ESRCH;