summaryrefslogtreecommitdiff
path: root/quotaio_v1.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2011-01-06 21:15:46 +0100
committerJan Kara <jack@suse.cz>2011-01-06 21:15:46 +0100
commit8a4dc3612c6c170c05e5eef68dd3555baeb341c1 (patch)
tree3df70c155be8776c1f549cdbe7e8a677453e8efc /quotaio_v1.c
parent346d2f876c988747f9dc1c57aa8c6fc92052e5de (diff)
Check whether set limits fit into the range supported by quota format.
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'quotaio_v1.c')
-rw-r--r--quotaio_v1.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/quotaio_v1.c b/quotaio_v1.c
index 1533ffc..305bff2 100644
--- a/quotaio_v1.c
+++ b/quotaio_v1.c
@@ -174,6 +174,10 @@ static int v1_init_io(struct quota_handle *h)
h->qh_info.dqi_bgrace = MAX_DQ_TIME;
if (!h->qh_info.dqi_igrace)
h->qh_info.dqi_igrace = MAX_IQ_TIME;
+ h->qh_info.dqi_max_b_limit = ~(uint32_t)0;
+ h->qh_info.dqi_max_i_limit = ~(uint32_t)0;
+ h->qh_info.dqi_max_b_usage = ((uint64_t)(~(uint32_t)0)) << V1_DQBLK_SIZE_BITS;
+ h->qh_info.dqi_max_i_usage = ~(uint32_t)0;
return 0;
}
@@ -327,6 +331,10 @@ static int v1_commit_dquot(struct dquot *dquot, int flags)
}
}
else {
+ if (check_dquot_range(dquot) < 0) {
+ errno = ERANGE;
+ return -1;
+ }
v1_mem2diskdqblk(&ddqblk, &dquot->dq_dqb);
lseek(h->qh_fd, (long)V1_DQOFF(dquot->dq_id), SEEK_SET);
if (write(h->qh_fd, &ddqblk, sizeof(ddqblk)) != sizeof(ddqblk))