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).
This commit is contained in:
Andriy Voskoboinyk 2017-07-04 07:07:08 +00:00
parent 88156ba581
commit 3737697159
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=320640
5 changed files with 10 additions and 7 deletions

View File

@ -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

View File

@ -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);

View File

@ -73,7 +73,7 @@ static const struct usb_config rtwn_config_common[RTWN_N_TRANSFER] = {
.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_N_TRANSFER] = {
.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_N_TRANSFER] = {
.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_N_TRANSFER] = {
.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,

View File

@ -233,6 +233,9 @@ rtwn_usb_tx_start(struct rtwn_softc *sc, struct ieee80211_node *ni,
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);

View File

@ -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