import PULS_20180308
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / fs / ubifs / budget.c
index e8e01d74dc0563a86d7185369afd842362f792a4..e342c573074fe2ef78edd4256af97a402c5320ce 100644 (file)
@@ -272,7 +272,7 @@ long long ubifs_calc_available(const struct ubifs_info *c, int min_idx_lebs)
  */
 static int can_use_rp(struct ubifs_info *c)
 {
-       if (uid_eq(current_fsuid(), c->rp_uid) || capable(CAP_SYS_RESOURCE) ||
+       if (uid_lte(current_fsuid(), c->rp_uid) || capable(CAP_SYS_RESOURCE) ||
            (!gid_eq(c->rp_gid, GLOBAL_ROOT_GID) && in_group_p(c->rp_gid)))
                return 1;
        return 0;
@@ -564,6 +564,10 @@ void ubifs_release_budget(struct ubifs_info *c, struct ubifs_budget_req *req)
 
        ubifs_assert(c->bi.idx_growth >= 0);
        ubifs_assert(c->bi.data_growth >= 0);
+       if(c->bi.dd_growth < 0) {
+               ubifs_err("c->bi.dd_growth %lld\n", c->bi.dd_growth);
+               c->bi.dd_growth = 0;
+       }
        ubifs_assert(c->bi.dd_growth >= 0);
        ubifs_assert(c->bi.min_idx_lebs < c->main_lebs);
        ubifs_assert(!(c->bi.idx_growth & 7));