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:
parent
88156ba581
commit
3737697159
@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
#define RTWN_TX_DESC_SIZE 64
|
#define RTWN_TX_DESC_SIZE 64
|
||||||
|
|
||||||
#define RTWN_TXBUFSZ (16 * 1024)
|
|
||||||
|
|
||||||
#define RTWN_BCN_MAX_SIZE 512
|
#define RTWN_BCN_MAX_SIZE 512
|
||||||
#define RTWN_CAM_ENTRY_LIMIT 64
|
#define RTWN_CAM_ENTRY_LIMIT 64
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ rtwn_usb_alloc_tx_list(struct rtwn_softc *sc)
|
|||||||
int error, i;
|
int error, i;
|
||||||
|
|
||||||
error = rtwn_usb_alloc_list(sc, uc->uc_tx, RTWN_USB_TX_LIST_COUNT,
|
error = rtwn_usb_alloc_list(sc, uc->uc_tx, RTWN_USB_TX_LIST_COUNT,
|
||||||
RTWN_TXBUFSZ);
|
RTWN_USB_TXBUFSZ);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ static const struct usb_config rtwn_config_common[RTWN_N_TRANSFER] = {
|
|||||||
.type = UE_BULK,
|
.type = UE_BULK,
|
||||||
.endpoint = UE_ADDR_ANY,
|
.endpoint = UE_ADDR_ANY,
|
||||||
.direction = UE_DIR_OUT,
|
.direction = UE_DIR_OUT,
|
||||||
.bufsize = RTWN_TXBUFSZ,
|
.bufsize = RTWN_USB_TXBUFSZ,
|
||||||
.flags = {
|
.flags = {
|
||||||
.ext_buffer = 1,
|
.ext_buffer = 1,
|
||||||
.pipe_bof = 1,
|
.pipe_bof = 1,
|
||||||
@ -86,7 +86,7 @@ static const struct usb_config rtwn_config_common[RTWN_N_TRANSFER] = {
|
|||||||
.type = UE_BULK,
|
.type = UE_BULK,
|
||||||
.endpoint = UE_ADDR_ANY,
|
.endpoint = UE_ADDR_ANY,
|
||||||
.direction = UE_DIR_OUT,
|
.direction = UE_DIR_OUT,
|
||||||
.bufsize = RTWN_TXBUFSZ,
|
.bufsize = RTWN_USB_TXBUFSZ,
|
||||||
.flags = {
|
.flags = {
|
||||||
.ext_buffer = 1,
|
.ext_buffer = 1,
|
||||||
.pipe_bof = 1,
|
.pipe_bof = 1,
|
||||||
@ -99,7 +99,7 @@ static const struct usb_config rtwn_config_common[RTWN_N_TRANSFER] = {
|
|||||||
.type = UE_BULK,
|
.type = UE_BULK,
|
||||||
.endpoint = UE_ADDR_ANY,
|
.endpoint = UE_ADDR_ANY,
|
||||||
.direction = UE_DIR_OUT,
|
.direction = UE_DIR_OUT,
|
||||||
.bufsize = RTWN_TXBUFSZ,
|
.bufsize = RTWN_USB_TXBUFSZ,
|
||||||
.flags = {
|
.flags = {
|
||||||
.ext_buffer = 1,
|
.ext_buffer = 1,
|
||||||
.pipe_bof = 1,
|
.pipe_bof = 1,
|
||||||
@ -112,7 +112,7 @@ static const struct usb_config rtwn_config_common[RTWN_N_TRANSFER] = {
|
|||||||
.type = UE_BULK,
|
.type = UE_BULK,
|
||||||
.endpoint = UE_ADDR_ANY,
|
.endpoint = UE_ADDR_ANY,
|
||||||
.direction = UE_DIR_OUT,
|
.direction = UE_DIR_OUT,
|
||||||
.bufsize = RTWN_TXBUFSZ,
|
.bufsize = RTWN_USB_TXBUFSZ,
|
||||||
.flags = {
|
.flags = {
|
||||||
.ext_buffer = 1,
|
.ext_buffer = 1,
|
||||||
.pipe_bof = 1,
|
.pipe_bof = 1,
|
||||||
|
@ -233,6 +233,9 @@ rtwn_usb_tx_start(struct rtwn_softc *sc, struct ieee80211_node *ni,
|
|||||||
|
|
||||||
RTWN_ASSERT_LOCKED(sc);
|
RTWN_ASSERT_LOCKED(sc);
|
||||||
|
|
||||||
|
if (m->m_pkthdr.len + sc->txdesc_len > RTWN_USB_TXBUFSZ)
|
||||||
|
return (EINVAL);
|
||||||
|
|
||||||
data = rtwn_usb_getbuf(uc);
|
data = rtwn_usb_getbuf(uc);
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
return (ENOBUFS);
|
return (ENOBUFS);
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
#ifndef RTWN_USBVAR_H
|
#ifndef RTWN_USBVAR_H
|
||||||
#define RTWN_USBVAR_H
|
#define RTWN_USBVAR_H
|
||||||
|
|
||||||
|
#define RTWN_USB_TXBUFSZ (16 * 1024)
|
||||||
|
|
||||||
#define RTWN_IFACE_INDEX 0
|
#define RTWN_IFACE_INDEX 0
|
||||||
|
|
||||||
#define RTWN_USB_RX_LIST_COUNT 1
|
#define RTWN_USB_RX_LIST_COUNT 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user