Module Name:    src
Committed By:   riastradh
Date:           Thu Jan  6 12:09:42 UTC 2022

Modified Files:
        src/sys/net/lagg: if_lagg_lacp.c

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/net/lagg/if_lagg_lacp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/lagg/if_lagg_lacp.c
diff -u src/sys/net/lagg/if_lagg_lacp.c:1.10 src/sys/net/lagg/if_lagg_lacp.c:1.11
--- src/sys/net/lagg/if_lagg_lacp.c:1.10	Fri Dec 31 14:24:51 2021
+++ src/sys/net/lagg/if_lagg_lacp.c	Thu Jan  6 12:09:42 2022
@@ -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 @@ lacp_linkstate(struct lagg_proto_softc *
 
 	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){

Reply via email to