Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-12581 osc: prevent use after free
[fs/lustre-release.git]
/
lustre
/
osd-ldiskfs
/
osd_quota_fmt.c
diff --git
a/lustre/osd-ldiskfs/osd_quota_fmt.c
b/lustre/osd-ldiskfs/osd_quota_fmt.c
index
a18f388
..
1883cd8
100644
(file)
--- a/
lustre/osd-ldiskfs/osd_quota_fmt.c
+++ b/
lustre/osd-ldiskfs/osd_quota_fmt.c
@@
-21,7
+21,7
@@
* GPL HEADER END
*/
/*
* GPL HEADER END
*/
/*
- * Copyright (c) 2012, 201
5
, Intel Corporation.
+ * Copyright (c) 2012, 201
6
, Intel Corporation.
* Use is subject to license terms.
*
* Lustre administrative quota format.
* Use is subject to license terms.
*
* Lustre administrative quota format.
@@
-64,7
+64,8
@@
static ssize_t quota_read_blk(const struct lu_env *env,
ENTRY;
memset(buf, 0, LUSTRE_DQBLKSIZE);
ENTRY;
memset(buf, 0, LUSTRE_DQBLKSIZE);
- LASSERTF((type == USRQUOTA || type == GRPQUOTA), "type=%d\n", type);
+ LASSERTF((type == USRQUOTA || type == GRPQUOTA || type == PRJQUOTA),
+ "type=%d\n", type);
ret = sb->s_op->quota_read(sb, type, buf, LUSTRE_DQBLKSIZE,
blk << LUSTRE_DQBLKSIZE_BITS);
ret = sb->s_op->quota_read(sb, type, buf, LUSTRE_DQBLKSIZE,
blk << LUSTRE_DQBLKSIZE_BITS);
@@
-276,7
+277,7
@@
int walk_tree_dqentry(const struct lu_env *env, struct osd_object *obj,
}
ret = 1;
}
ret = 1;
- for (; index <= 0xff
&& ret > 0
; index++) {
+ for (; index <= 0xff; index++) {
blk = le32_to_cpu(ref[index]);
if (!blk) /* No reference */
continue;
blk = le32_to_cpu(ref[index]);
if (!blk) /* No reference */
continue;
@@
-286,13
+287,14
@@
int walk_tree_dqentry(const struct lu_env *env, struct osd_object *obj,
depth + 1, 0, it);
else
ret = walk_block_dqentry(env, obj, type, blk, 0, it);
depth + 1, 0, it);
else
ret = walk_block_dqentry(env, obj, type, blk, 0, it);
- }
- if (ret == 0) { /* Entry found */
- it->oiq_blk[depth + 1] = blk;
- it->oiq_index[depth] = index;
+ if (ret <= 0)
+ break;
}
}
+ it->oiq_blk[depth + 1] = blk;
+ it->oiq_index[depth] = index;
+
out_buf:
freedqbuf(buf);
RETURN(ret);
out_buf:
freedqbuf(buf);
RETURN(ret);