From owner-svn-src-head@freebsd.org Mon Jan 9 23:42:04 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3CB7BCA8038; Mon, 9 Jan 2017 23:42:04 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E728B1A98; Mon, 9 Jan 2017 23:42:03 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v09Ng3Wk050703; Mon, 9 Jan 2017 23:42:03 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v09Ng32n050702; Mon, 9 Jan 2017 23:42:03 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201701092342.v09Ng32n050702@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Mon, 9 Jan 2017 23:42:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r311838 - head/sys/dev/rtwn/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2017 23:42:04 -0000 Author: avos Date: Mon Jan 9 23:42:02 2017 New Revision: 311838 URL: https://svnweb.freebsd.org/changeset/base/311838 Log: rtwn_usb(4): do not try to modify global static structure. Use a local copy for modifications instead. Tested with RTL8821AU (AP) + RTL8188EU (STA). Reported by: hselasky Modified: head/sys/dev/rtwn/usb/rtwn_usb_ep.c Modified: head/sys/dev/rtwn/usb/rtwn_usb_ep.c ============================================================================== --- head/sys/dev/rtwn/usb/rtwn_usb_ep.c Mon Jan 9 23:41:10 2017 (r311837) +++ head/sys/dev/rtwn/usb/rtwn_usb_ep.c Mon Jan 9 23:42:02 2017 (r311838) @@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$"); #include -static struct usb_config rtwn_config[RTWN_N_TRANSFER] = { +static const struct usb_config rtwn_config_common[RTWN_N_TRANSFER] = { [RTWN_BULK_RX] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -161,6 +161,7 @@ rtwn_usb_setup_queues(struct rtwn_usb_so int rtwn_usb_setup_endpoints(struct rtwn_usb_softc *uc) { + struct usb_config *rtwn_config; struct rtwn_softc *sc = &uc->uc_sc; const uint8_t iface_index = RTWN_IFACE_INDEX; struct usb_endpoint *ep, *ep_end; @@ -197,6 +198,9 @@ rtwn_usb_setup_endpoints(struct rtwn_usb return (EINVAL); } + rtwn_config = malloc(sizeof(rtwn_config_common), M_TEMP, M_WAITOK); + memcpy(rtwn_config, rtwn_config_common, sizeof(rtwn_config_common)); + /* NB: keep in sync with rtwn_dma_init(). */ rtwn_config[RTWN_BULK_TX_VO].endpoint = addr[0]; switch (uc->ntx) { @@ -224,6 +228,8 @@ rtwn_usb_setup_endpoints(struct rtwn_usb rtwn_config[RTWN_BULK_RX].bufsize = sc->rx_dma_size + 1024; error = usbd_transfer_setup(uc->uc_udev, &iface_index, uc->uc_xfer, rtwn_config, RTWN_N_TRANSFER, uc, &sc->sc_mtx); + free(rtwn_config, M_TEMP); + if (error) { device_printf(sc->sc_dev, "could not allocate USB transfers, " "err=%s\n", usbd_errstr(error));