From 75f5224ea88181509bb372ae18dd19e334a24cbc Mon Sep 17 00:00:00 2001 From: Ganbold Tsagaankhuu Date: Wed, 25 Dec 2019 11:26:38 +0000 Subject: [PATCH] Fix panic when running etherswitchcfg port command. --- sys/dev/etherswitch/e6000sw/e6000sw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/etherswitch/e6000sw/e6000sw.c b/sys/dev/etherswitch/e6000sw/e6000sw.c index 234c9ab131a8..4803e200e8fb 100644 --- a/sys/dev/etherswitch/e6000sw/e6000sw.c +++ b/sys/dev/etherswitch/e6000sw/e6000sw.c @@ -849,6 +849,8 @@ e6000sw_setport(device_t dev, etherswitch_port_t *p) if (!e6000sw_is_portenabled(sc, p->es_port)) return (0); + E6000SW_LOCK(sc); + /* Port flags. */ reg = e6000sw_readreg(sc, REG_PORT(sc, p->es_port), PORT_CONTROL2); if (p->es_flags & ETHERSWITCH_PORT_DROPTAGGED) @@ -862,7 +864,6 @@ e6000sw_setport(device_t dev, etherswitch_port_t *p) e6000sw_writereg(sc, REG_PORT(sc, p->es_port), PORT_CONTROL2, reg); err = 0; - E6000SW_LOCK(sc); if (p->es_pvid != 0) e6000sw_set_pvid(sc, p->es_port, p->es_pvid); if (e6000sw_is_phyport(sc, p->es_port)) {