If a quota-enabled file system has 65536 active vnodes for one uid
the reference counter of the corresponding struct dquot will overflow. Change the type of the reference counter from u_int16_t to u_int32_t and add an assertion to check for overflow. Observed and tested by Edgar Fuß. Welcome to 4.99.21 (struct dquot and therefore struct inode changed layout)
This commit is contained in:
parent
1d3b6feacb
commit
bed04c995a
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: param.h,v 1.262 2007/05/17 14:53:33 yamt Exp $ */
|
||||
/* $NetBSD: param.h,v 1.263 2007/06/23 14:56:10 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
|
@ -63,7 +63,7 @@
|
|||
* 2.99.9 (299000900)
|
||||
*/
|
||||
|
||||
#define __NetBSD_Version__ 499002000 /* NetBSD 4.99.20 */
|
||||
#define __NetBSD_Version__ 499002100 /* NetBSD 4.99.21 */
|
||||
|
||||
#define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \
|
||||
(m) * 1000000) + (p) * 100) <= __NetBSD_Version__)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: quota.h,v 1.23 2007/03/04 06:03:46 christos Exp $ */
|
||||
/* $NetBSD: quota.h,v 1.24 2007/06/23 14:56:09 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
|
@ -118,9 +118,8 @@ struct dquot {
|
|||
LIST_ENTRY(dquot) dq_hash; /* hash list */
|
||||
TAILQ_ENTRY(dquot) dq_freelist; /* free list */
|
||||
u_int16_t dq_flags; /* flags, see below */
|
||||
u_int16_t dq_cnt; /* count of active references */
|
||||
u_int16_t dq_spare; /* unused spare padding */
|
||||
u_int16_t dq_type; /* quota type of this dquot */
|
||||
u_int32_t dq_cnt; /* count of active references */
|
||||
u_int32_t dq_id; /* identifier this applies to */
|
||||
struct ufsmount *dq_ump; /* filesystem that this is taken from */
|
||||
struct dqblk dq_dqb; /* actual usage & quotas */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ufs_quota.c,v 1.45 2007/04/07 14:21:52 hannken Exp $ */
|
||||
/* $NetBSD: ufs_quota.c,v 1.46 2007/06/23 14:56:10 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1990, 1993, 1995
|
||||
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.45 2007/04/07 14:21:52 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.46 2007/06/23 14:56:10 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
|
@ -816,6 +816,7 @@ dqref(struct dquot *dq)
|
|||
{
|
||||
|
||||
dq->dq_cnt++;
|
||||
KASSERT(dq->dq_cnt > 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue