Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/common compat_50_quota: reject invalid quota id t...



details:   https://anonhg.NetBSD.org/src/rev/56082e0dba86
branches:  trunk
changeset: 370178:56082e0dba86
user:      dholland <dholland%NetBSD.org@localhost>
date:      Wed Sep 21 07:15:24 2022 +0000

description:
compat_50_quota: reject invalid quota id types.

Reported-by: syzbot+ce8391eb74a16e1967ab%syzkaller.appspotmail.com@localhost

diffstat:

 sys/compat/common/compat_50_quota.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r dece37689dd4 -r 56082e0dba86 sys/compat/common/compat_50_quota.c
--- a/sys/compat/common/compat_50_quota.c       Wed Sep 21 07:07:34 2022 +0000
+++ b/sys/compat/common/compat_50_quota.c       Wed Sep 21 07:15:24 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_50_quota.c,v 1.3 2020/03/09 00:42:36 pgoyette Exp $ */
+/*     $NetBSD: compat_50_quota.c,v 1.4 2022/09/21 07:15:24 dholland Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_50_quota.c,v 1.3 2020/03/09 00:42:36 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_50_quota.c,v 1.4 2022/09/21 07:15:24 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -83,6 +83,9 @@
        mp = vp->v_mount;
        q1cmd = SCARG(uap, cmd);
        idtype = quota_idtype_from_ufs(q1cmd & SUBCMDMASK);
+       if (idtype == -1) {
+               return EINVAL;
+       }
 
        switch ((q1cmd & ~SUBCMDMASK) >> SUBCMDSHIFT) {
        case Q_QUOTAON:



Home | Main Index | Thread Index | Old Index