Source-Changes-HG archive

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

[.joined/src/trunk]: .joined/src/sys/altq altq(9): Fix missing IFNET_LOCK aro...



details:   https://anonhg.NetBSD.org/.joined/src/rev/105be8f5c7a7
branches:  trunk
changeset: 359344:105be8f5c7a7
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Dec 31 14:25:47 2021 +0000

description:
altq(9): Fix missing IFNET_LOCK around if_ioctl.

diffstat:

 sys/altq/altq_afmap.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r 7b4a858c7791 -r 105be8f5c7a7 sys/altq/altq_afmap.c
--- a/sys/altq/altq_afmap.c     Fri Dec 31 14:25:22 2021 +0000
+++ b/sys/altq/altq_afmap.c     Fri Dec 31 14:25:47 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: altq_afmap.c,v 1.22 2021/12/31 14:24:50 riastradh Exp $        */
+/*     $NetBSD: altq_afmap.c,v 1.23 2021/12/31 14:25:47 riastradh Exp $        */
 /*     $KAME: altq_afmap.c,v 1.12 2005/04/13 03:44:24 suz Exp $        */
 
 /*
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altq_afmap.c,v 1.22 2021/12/31 14:24:50 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_afmap.c,v 1.23 2021/12/31 14:25:47 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altq.h"
@@ -369,10 +369,15 @@
        flowmap = (struct atm_flowmap *)addr;
        flowmap->af_ifname[IFNAMSIZ-1] = '\0';
        ifp = ifunit(flowmap->af_ifname);
-       if (ifp == NULL || (ifp->if_flags & IFF_RUNNING) == 0)
+       if (ifp == NULL)
+               return ENXIO;
+
+       IFNET_LOCK(ifp);
+       if ((ifp->if_flags & IFF_RUNNING) == 0)
                error = ENXIO;
        else
                error = if_ioctl(ifp, cmd, addr);
+       IFNET_UNLOCK(ifp);
 
        return error;
 }



Home | Main Index | Thread Index | Old Index