Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/ufs/ufs Pull up following revision(s) (requested by n...



details:   https://anonhg.NetBSD.org/src/rev/c48920d6ed19
branches:  netbsd-9
changeset: 964252:c48920d6ed19
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Jan 01 13:17:08 2021 +0000

description:
Pull up following revision(s) (requested by nia in ticket #1176):

        sys/ufs/ufs/ufs_quota1.c: revision 1.23

Avoid potentially accessing an array with an index out of range.

diffstat:

 sys/ufs/ufs/ufs_quota1.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r 5de386d6a389 -r c48920d6ed19 sys/ufs/ufs/ufs_quota1.c
--- a/sys/ufs/ufs/ufs_quota1.c  Fri Jan 01 13:14:29 2021 +0000
+++ b/sys/ufs/ufs/ufs_quota1.c  Fri Jan 01 13:17:08 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_quota1.c,v 1.22 2016/06/20 00:52:04 dholland Exp $ */
+/*     $NetBSD: ufs_quota1.c,v 1.22.22.1 2021/01/01 13:17:08 martin Exp $      */
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_quota1.c,v 1.22 2016/06/20 00:52:04 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_quota1.c,v 1.22.22.1 2021/01/01 13:17:08 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -311,6 +311,9 @@
        struct pathbuf *pb;
        struct nameidata nd;
 
+       if (type < 0 || type >= MAXQUOTAS)
+               return EINVAL;
+
        if (ump->um_flags & UFS_QUOTA2) {
                uprintf("%s: quotas v2 already enabled\n",
                    mp->mnt_stat.f_mntonname);
@@ -421,6 +424,9 @@
        kauth_cred_t cred;
        int i, error;
 
+       if (type < 0 || type >= MAXQUOTAS)
+               return EINVAL;
+
        mutex_enter(&dqlock);
        while ((ump->umq1_qflags[type] & (QTF_CLOSING | QTF_OPENING)) != 0)
                cv_wait(&dqcv, &dqlock);



Home | Main Index | Thread Index | Old Index