From b7cb5d9d352141944c620969856e13d1dfeb0fe4 Mon Sep 17 00:00:00 2001 From: skrll Date: Tue, 11 Oct 2016 15:48:17 +0000 Subject: [PATCH] Read sc_if_flags after taking core lock --- sys/dev/pci/if_wm.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/dev/pci/if_wm.c b/sys/dev/pci/if_wm.c index befa37c9b63a..ad475557ecef 100644 --- a/sys/dev/pci/if_wm.c +++ b/sys/dev/pci/if_wm.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.417 2016/08/10 04:52:40 knakahara Exp $ */ +/* $NetBSD: if_wm.c,v 1.418 2016/10/11 15:48:17 skrll Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -84,7 +84,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.417 2016/08/10 04:52:40 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.418 2016/10/11 15:48:17 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -2807,13 +2807,12 @@ wm_ifflags_cb(struct ethercom *ec) { struct ifnet *ifp = &ec->ec_if; struct wm_softc *sc = ifp->if_softc; - int change = ifp->if_flags ^ sc->sc_if_flags; int rc = 0; WM_CORE_LOCK(sc); - if (change != 0) - sc->sc_if_flags = ifp->if_flags; + int change = ifp->if_flags ^ sc->sc_if_flags; + sc->sc_if_flags = ifp->if_flags; if ((change & ~(IFF_CANTCHANGE | IFF_DEBUG)) != 0) { rc = ENETRESET;