Source-Changes-HG archive

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

[src/trunk]: src/sys/net/lagg lagg(4): Take lock as required around if ioctl.



details:   https://anonhg.NetBSD.org/src/rev/9c60f92f8b36
branches:  trunk
changeset: 359441:9c60f92f8b36
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Jan 06 12:09:42 2022 +0000

description:
lagg(4): Take lock as required around if ioctl.

Note: There are some calls to SIOCADDMULTI/SIOCDELMULTI that take the
lock when they don't need it, but it's not clear it's harmful either
unless they come via a caller that holds softnet_lock.

candidate fix for
https://mail-index.netbsd.org/current-users/2021/12/31/msg041876.html

ok yamaguchi

diffstat:

 sys/net/lagg/if_lagg_lacp.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 13d08b638a08 -r 9c60f92f8b36 sys/net/lagg/if_lagg_lacp.c
--- a/sys/net/lagg/if_lagg_lacp.c       Thu Jan 06 09:01:16 2022 +0000
+++ b/sys/net/lagg/if_lagg_lacp.c       Thu Jan 06 12:09:42 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_lagg_lacp.c,v 1.10 2021/12/31 14:24:51 riastradh Exp $      */
+/*     $NetBSD: if_lagg_lacp.c,v 1.11 2022/01/06 12:09:42 riastradh Exp $      */
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-NetBSD
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_lagg_lacp.c,v 1.10 2021/12/31 14:24:51 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lagg_lacp.c,v 1.11 2022/01/06 12:09:42 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_lagg.h"
@@ -839,7 +839,9 @@
 
        memset(&ifmr, 0, sizeof(ifmr));
        ifmr.ifm_count = 0;
+       IFNET_LOCK(ifp_port);
        error = if_ioctl(ifp_port, SIOCGIFMEDIA, (void *)&ifmr);
+       IFNET_UNLOCK(ifp_port);
        if (error == 0) {
                media = lacp_ifmedia2lacpmedia(ifmr.ifm_active);
        } else if (error != ENOTTY){



Home | Main Index | Thread Index | Old Index