Date: Tue, 4 Jul 2017 07:07:08 +0000 (UTC) From: Andriy Voskoboinyk <avos@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320640 - in head/sys/dev/rtwn: . usb Message-ID: <201707040707.v64778xj058240@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avos Date: Tue Jul 4 07:07:08 2017 New Revision: 320640 URL: https://svnweb.freebsd.org/changeset/base/320640 Log: rtwn_usb: reject too long (>16K) mbufs. While here move RTWN_TXBUFSZ constant from common to USB specific code (it's not used anywhere else). Modified: head/sys/dev/rtwn/if_rtwnvar.h head/sys/dev/rtwn/usb/rtwn_usb_attach.c head/sys/dev/rtwn/usb/rtwn_usb_ep.c head/sys/dev/rtwn/usb/rtwn_usb_tx.c head/sys/dev/rtwn/usb/rtwn_usb_var.h Modified: head/sys/dev/rtwn/if_rtwnvar.h ============================================================================== --- head/sys/dev/rtwn/if_rtwnvar.h Tue Jul 4 05:37:58 2017 (r320639) +++ head/sys/dev/rtwn/if_rtwnvar.h Tue Jul 4 07:07:08 2017 (r320640) @@ -25,8 +25,6 @@ #define RTWN_TX_DESC_SIZE 64 -#define RTWN_TXBUFSZ (16 * 1024) - #define RTWN_BCN_MAX_SIZE 512 #define RTWN_CAM_ENTRY_LIMIT 64 Modified: head/sys/dev/rtwn/usb/rtwn_usb_attach.c ============================================================================== --- head/sys/dev/rtwn/usb/rtwn_usb_attach.c Tue Jul 4 05:37:58 2017 (r320639) +++ head/sys/dev/rtwn/usb/rtwn_usb_attach.c Tue Jul 4 07:07:08 2017 (r320640) @@ -155,7 +155,7 @@ rtwn_usb_alloc_tx_list(struct rtwn_softc *sc) int error, i; error = rtwn_usb_alloc_list(sc, uc->uc_tx, RTWN_USB_TX_LIST_COUNT, - RTWN_TXBUFSZ); + RTWN_USB_TXBUFSZ); if (error != 0) return (error); Modified: head/sys/dev/rtwn/usb/rtwn_usb_ep.c ============================================================================== --- head/sys/dev/rtwn/usb/rtwn_usb_ep.c Tue Jul 4 05:37:58 2017 (r320639) +++ head/sys/dev/rtwn/usb/rtwn_usb_ep.c Tue Jul 4 07:07:08 2017 (r320640) @@ -73,7 +73,7 @@ static const struct usb_config rtwn_config_common[RTWN .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .bufsize = RTWN_TXBUFSZ, + .bufsize = RTWN_USB_TXBUFSZ, .flags = { .ext_buffer = 1, .pipe_bof = 1, @@ -86,7 +86,7 @@ static const struct usb_config rtwn_config_common[RTWN .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .bufsize = RTWN_TXBUFSZ, + .bufsize = RTWN_USB_TXBUFSZ, .flags = { .ext_buffer = 1, .pipe_bof = 1, @@ -99,7 +99,7 @@ static const struct usb_config rtwn_config_common[RTWN .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .bufsize = RTWN_TXBUFSZ, + .bufsize = RTWN_USB_TXBUFSZ, .flags = { .ext_buffer = 1, .pipe_bof = 1, @@ -112,7 +112,7 @@ static const struct usb_config rtwn_config_common[RTWN .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .bufsize = RTWN_TXBUFSZ, + .bufsize = RTWN_USB_TXBUFSZ, .flags = { .ext_buffer = 1, .pipe_bof = 1, Modified: head/sys/dev/rtwn/usb/rtwn_usb_tx.c ============================================================================== --- head/sys/dev/rtwn/usb/rtwn_usb_tx.c Tue Jul 4 05:37:58 2017 (r320639) +++ head/sys/dev/rtwn/usb/rtwn_usb_tx.c Tue Jul 4 07:07:08 2017 (r320640) @@ -233,6 +233,9 @@ rtwn_usb_tx_start(struct rtwn_softc *sc, struct ieee80 RTWN_ASSERT_LOCKED(sc); + if (m->m_pkthdr.len + sc->txdesc_len > RTWN_USB_TXBUFSZ) + return (EINVAL); + data = rtwn_usb_getbuf(uc); if (data == NULL) return (ENOBUFS); Modified: head/sys/dev/rtwn/usb/rtwn_usb_var.h ============================================================================== --- head/sys/dev/rtwn/usb/rtwn_usb_var.h Tue Jul 4 05:37:58 2017 (r320639) +++ head/sys/dev/rtwn/usb/rtwn_usb_var.h Tue Jul 4 07:07:08 2017 (r320640) @@ -21,6 +21,8 @@ #ifndef RTWN_USBVAR_H #define RTWN_USBVAR_H +#define RTWN_USB_TXBUFSZ (16 * 1024) + #define RTWN_IFACE_INDEX 0 #define RTWN_USB_RX_LIST_COUNT 1
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707040707.v64778xj058240>