summaryrefslogtreecommitdiff
path: root/quotaio_v2.c
diff options
context:
space:
mode:
authorjkar8572 <jkar8572>2005-03-17 11:14:34 +0000
committerjkar8572 <jkar8572>2005-03-17 11:14:34 +0000
commitaed1deba584ead039d51d1fe09ccab3123304c59 (patch)
tree3c45c138b531bce0a51801df0481162f4ec92aa6 /quotaio_v2.c
parentd9b0d03470bd6a47d375f664aee03a454e577951 (diff)
downloadlinuxquota-aed1deba584ead039d51d1fe09ccab3123304c59.tar.gz
Fixed illegal reference checking in quotacheck(8) (Jan Kara)
Fix of fix of sanity check in repquota(8) (Jan Kara)
Diffstat (limited to 'quotaio_v2.c')
-rw-r--r--quotaio_v2.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/quotaio_v2.c b/quotaio_v2.c
index 6ba7225..5176435 100644
--- a/quotaio_v2.c
+++ b/quotaio_v2.c
@@ -748,6 +748,12 @@ static int report_block(struct dquot *dquot, uint blk, char *bitmap,
return entries;
}
+static void check_reference(struct quota_handle *h, uint blk)
+{
+ if (blk >= h->qh_info.u.v2_mdqi.dqi_blocks)
+ die(2, _("Illegal reference in %s quota file on %s. Quota file is probably corrupted.\nPlease run quotacheck(8) and try again.\n"), type2name(h->qh_type), h->qh_quotadev);
+}
+
static int report_tree(struct dquot *dquot, uint blk, int depth, char *bitmap,
int (*process_dquot) (struct dquot *, char *))
{
@@ -759,17 +765,18 @@ static int report_tree(struct dquot *dquot, uint blk, int depth, char *bitmap,
if (depth == V2_DQTREEDEPTH - 1) {
for (i = 0; i < V2_DQBLKSIZE >> 2; i++) {
blk = __le32_to_cpu(ref[i]);
- if (blk >= dquot->dq_h->qh_info.u.v2_mdqi.dqi_blocks)
- die(2, _("Illegal reference in %s quota file on %s. Quota file is probably corrupted.\nPlease run quotacheck(8) and try again.\n"), type2name(dquot->dq_h->qh_type), dquot->dq_h->qh_quotadev);
+ check_reference(dquot->dq_h, blk);
if (blk && !get_bit(bitmap, blk))
entries += report_block(dquot, blk, bitmap, process_dquot);
}
}
else {
for (i = 0; i < V2_DQBLKSIZE >> 2; i++)
- if ((blk = __le32_to_cpu(ref[i])))
+ if ((blk = __le32_to_cpu(ref[i]))) {
+ check_reference(dquot->dq_h, blk);
entries +=
report_tree(dquot, blk, depth + 1, bitmap, process_dquot);
+ }
}
freedqbuf(buf);
return entries;