Commit be61af33 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'staging-5.12-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging driver fixes from Greg KH:
 "Here are some small staging driver fixes for reported problems. They
  include:

   - wfx header file cleanup patch reverted as it could cause problems

   - comedi driver endian fixes

   - buffer overflow problems for staging wifi drivers

   - build dependency issue for rtl8192e driver

  All have been in linux-next for a while with no reported problems"

* tag 'staging-5.12-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (23 commits)
  Revert "staging: wfx: remove unused included header files"
  staging: rtl8188eu: prevent ->ssid overflow in rtw_wx_set_scan()
  staging: rtl8188eu: fix potential memory corruption in rtw_check_beacon_data()
  staging: rtl8192u: fix ->ssid overflow in r8192_wx_set_scan()
  staging: comedi: pcl726: Use 16-bit 0 for interrupt data
  staging: comedi: ni_65xx: Use 16-bit 0 for interrupt data
  staging: comedi: ni_6527: Use 16-bit 0 for interrupt data
  staging: comedi: comedi_parport: Use 16-bit 0 for interrupt data
  staging: comedi: amplc_pc236_common: Use 16-bit 0 for interrupt data
  staging: comedi: pcl818: Fix endian problem for AI command data
  staging: comedi: pcl711: Fix endian problem for AI command data
  staging: comedi: me4000: Fix endian problem for AI command data
  staging: comedi: dmm32at: Fix endian problem for AI command data
  staging: comedi: das800: Fix endian problem for AI command data
  staging: comedi: das6402: Fix endian problem for AI command data
  staging: comedi: adv_pci1710: Fix endian problem for AI command data
  staging: comedi: addi_apci_1500: Fix endian problem for command sample
  staging: comedi: addi_apci_1032: Fix endian problem for COS sample
  staging: ks7010: prevent buffer overflow in ks_wlan_set_scan()
  staging: rtl8712: Fix possible buffer overflow in r8712_sitesurvey_cmd
  ...
parents cc14086f 16d7586d
...@@ -260,6 +260,7 @@ static irqreturn_t apci1032_interrupt(int irq, void *d) ...@@ -260,6 +260,7 @@ static irqreturn_t apci1032_interrupt(int irq, void *d)
struct apci1032_private *devpriv = dev->private; struct apci1032_private *devpriv = dev->private;
struct comedi_subdevice *s = dev->read_subdev; struct comedi_subdevice *s = dev->read_subdev;
unsigned int ctrl; unsigned int ctrl;
unsigned short val;
/* check interrupt is from this device */ /* check interrupt is from this device */
if ((inl(devpriv->amcc_iobase + AMCC_OP_REG_INTCSR) & if ((inl(devpriv->amcc_iobase + AMCC_OP_REG_INTCSR) &
...@@ -275,7 +276,8 @@ static irqreturn_t apci1032_interrupt(int irq, void *d) ...@@ -275,7 +276,8 @@ static irqreturn_t apci1032_interrupt(int irq, void *d)
outl(ctrl & ~APCI1032_CTRL_INT_ENA, dev->iobase + APCI1032_CTRL_REG); outl(ctrl & ~APCI1032_CTRL_INT_ENA, dev->iobase + APCI1032_CTRL_REG);
s->state = inl(dev->iobase + APCI1032_STATUS_REG) & 0xffff; s->state = inl(dev->iobase + APCI1032_STATUS_REG) & 0xffff;
comedi_buf_write_samples(s, &s->state, 1); val = s->state;
comedi_buf_write_samples(s, &val, 1);
comedi_handle_events(dev, s); comedi_handle_events(dev, s);
/* enable the interrupt */ /* enable the interrupt */
......
...@@ -208,7 +208,7 @@ static irqreturn_t apci1500_interrupt(int irq, void *d) ...@@ -208,7 +208,7 @@ static irqreturn_t apci1500_interrupt(int irq, void *d)
struct comedi_device *dev = d; struct comedi_device *dev = d;
struct apci1500_private *devpriv = dev->private; struct apci1500_private *devpriv = dev->private;
struct comedi_subdevice *s = dev->read_subdev; struct comedi_subdevice *s = dev->read_subdev;
unsigned int status = 0; unsigned short status = 0;
unsigned int val; unsigned int val;
val = inl(devpriv->amcc + AMCC_OP_REG_INTCSR); val = inl(devpriv->amcc + AMCC_OP_REG_INTCSR);
...@@ -238,14 +238,14 @@ static irqreturn_t apci1500_interrupt(int irq, void *d) ...@@ -238,14 +238,14 @@ static irqreturn_t apci1500_interrupt(int irq, void *d)
* *
* Mask Meaning * Mask Meaning
* ---------- ------------------------------------------ * ---------- ------------------------------------------
* 0x00000001 Event 1 has occurred * 0b00000001 Event 1 has occurred
* 0x00000010 Event 2 has occurred * 0b00000010 Event 2 has occurred
* 0x00000100 Counter/timer 1 has run down (not implemented) * 0b00000100 Counter/timer 1 has run down (not implemented)
* 0x00001000 Counter/timer 2 has run down (not implemented) * 0b00001000 Counter/timer 2 has run down (not implemented)
* 0x00010000 Counter 3 has run down (not implemented) * 0b00010000 Counter 3 has run down (not implemented)
* 0x00100000 Watchdog has run down (not implemented) * 0b00100000 Watchdog has run down (not implemented)
* 0x01000000 Voltage error * 0b01000000 Voltage error
* 0x10000000 Short-circuit error * 0b10000000 Short-circuit error
*/ */
comedi_buf_write_samples(s, &status, 1); comedi_buf_write_samples(s, &status, 1);
comedi_handle_events(dev, s); comedi_handle_events(dev, s);
......
...@@ -300,11 +300,11 @@ static int pci1710_ai_eoc(struct comedi_device *dev, ...@@ -300,11 +300,11 @@ static int pci1710_ai_eoc(struct comedi_device *dev,
static int pci1710_ai_read_sample(struct comedi_device *dev, static int pci1710_ai_read_sample(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
unsigned int cur_chan, unsigned int cur_chan,
unsigned int *val) unsigned short *val)
{ {
const struct boardtype *board = dev->board_ptr; const struct boardtype *board = dev->board_ptr;
struct pci1710_private *devpriv = dev->private; struct pci1710_private *devpriv = dev->private;
unsigned int sample; unsigned short sample;
unsigned int chan; unsigned int chan;
sample = inw(dev->iobase + PCI171X_AD_DATA_REG); sample = inw(dev->iobase + PCI171X_AD_DATA_REG);
...@@ -345,7 +345,7 @@ static int pci1710_ai_insn_read(struct comedi_device *dev, ...@@ -345,7 +345,7 @@ static int pci1710_ai_insn_read(struct comedi_device *dev,
pci1710_ai_setup_chanlist(dev, s, &insn->chanspec, 1, 1); pci1710_ai_setup_chanlist(dev, s, &insn->chanspec, 1, 1);
for (i = 0; i < insn->n; i++) { for (i = 0; i < insn->n; i++) {
unsigned int val; unsigned short val;
/* start conversion */ /* start conversion */
outw(0, dev->iobase + PCI171X_SOFTTRG_REG); outw(0, dev->iobase + PCI171X_SOFTTRG_REG);
...@@ -395,7 +395,7 @@ static void pci1710_handle_every_sample(struct comedi_device *dev, ...@@ -395,7 +395,7 @@ static void pci1710_handle_every_sample(struct comedi_device *dev,
{ {
struct comedi_cmd *cmd = &s->async->cmd; struct comedi_cmd *cmd = &s->async->cmd;
unsigned int status; unsigned int status;
unsigned int val; unsigned short val;
int ret; int ret;
status = inw(dev->iobase + PCI171X_STATUS_REG); status = inw(dev->iobase + PCI171X_STATUS_REG);
...@@ -455,7 +455,7 @@ static void pci1710_handle_fifo(struct comedi_device *dev, ...@@ -455,7 +455,7 @@ static void pci1710_handle_fifo(struct comedi_device *dev,
} }
for (i = 0; i < devpriv->max_samples; i++) { for (i = 0; i < devpriv->max_samples; i++) {
unsigned int val; unsigned short val;
int ret; int ret;
ret = pci1710_ai_read_sample(dev, s, s->async->cur_chan, &val); ret = pci1710_ai_read_sample(dev, s, s->async->cur_chan, &val);
......
...@@ -126,7 +126,9 @@ static irqreturn_t pc236_interrupt(int irq, void *d) ...@@ -126,7 +126,9 @@ static irqreturn_t pc236_interrupt(int irq, void *d)
handled = pc236_intr_check(dev); handled = pc236_intr_check(dev);
if (dev->attached && handled) { if (dev->attached && handled) {
comedi_buf_write_samples(s, &s->state, 1); unsigned short val = 0;
comedi_buf_write_samples(s, &val, 1);
comedi_handle_events(dev, s); comedi_handle_events(dev, s);
} }
return IRQ_RETVAL(handled); return IRQ_RETVAL(handled);
......
...@@ -210,12 +210,13 @@ static irqreturn_t parport_interrupt(int irq, void *d) ...@@ -210,12 +210,13 @@ static irqreturn_t parport_interrupt(int irq, void *d)
struct comedi_device *dev = d; struct comedi_device *dev = d;
struct comedi_subdevice *s = dev->read_subdev; struct comedi_subdevice *s = dev->read_subdev;
unsigned int ctrl; unsigned int ctrl;
unsigned short val = 0;
ctrl = inb(dev->iobase + PARPORT_CTRL_REG); ctrl = inb(dev->iobase + PARPORT_CTRL_REG);
if (!(ctrl & PARPORT_CTRL_IRQ_ENA)) if (!(ctrl & PARPORT_CTRL_IRQ_ENA))
return IRQ_NONE; return IRQ_NONE;
comedi_buf_write_samples(s, &s->state, 1); comedi_buf_write_samples(s, &val, 1);
comedi_handle_events(dev, s); comedi_handle_events(dev, s);
return IRQ_HANDLED; return IRQ_HANDLED;
......
...@@ -186,7 +186,7 @@ static irqreturn_t das6402_interrupt(int irq, void *d) ...@@ -186,7 +186,7 @@ static irqreturn_t das6402_interrupt(int irq, void *d)
if (status & DAS6402_STATUS_FFULL) { if (status & DAS6402_STATUS_FFULL) {
async->events |= COMEDI_CB_OVERFLOW; async->events |= COMEDI_CB_OVERFLOW;
} else if (status & DAS6402_STATUS_FFNE) { } else if (status & DAS6402_STATUS_FFNE) {
unsigned int val; unsigned short val;
val = das6402_ai_read_sample(dev, s); val = das6402_ai_read_sample(dev, s);
comedi_buf_write_samples(s, &val, 1); comedi_buf_write_samples(s, &val, 1);
......
...@@ -427,7 +427,7 @@ static irqreturn_t das800_interrupt(int irq, void *d) ...@@ -427,7 +427,7 @@ static irqreturn_t das800_interrupt(int irq, void *d)
struct comedi_cmd *cmd; struct comedi_cmd *cmd;
unsigned long irq_flags; unsigned long irq_flags;
unsigned int status; unsigned int status;
unsigned int val; unsigned short val;
bool fifo_empty; bool fifo_empty;
bool fifo_overflow; bool fifo_overflow;
int i; int i;
......
...@@ -404,7 +404,7 @@ static irqreturn_t dmm32at_isr(int irq, void *d) ...@@ -404,7 +404,7 @@ static irqreturn_t dmm32at_isr(int irq, void *d)
{ {
struct comedi_device *dev = d; struct comedi_device *dev = d;
unsigned char intstat; unsigned char intstat;
unsigned int val; unsigned short val;
int i; int i;
if (!dev->attached) { if (!dev->attached) {
......
...@@ -924,7 +924,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) ...@@ -924,7 +924,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id)
struct comedi_subdevice *s = dev->read_subdev; struct comedi_subdevice *s = dev->read_subdev;
int i; int i;
int c = 0; int c = 0;
unsigned int lval; unsigned short lval;
if (!dev->attached) if (!dev->attached)
return IRQ_NONE; return IRQ_NONE;
......
...@@ -195,7 +195,9 @@ static irqreturn_t ni6527_interrupt(int irq, void *d) ...@@ -195,7 +195,9 @@ static irqreturn_t ni6527_interrupt(int irq, void *d)
return IRQ_NONE; return IRQ_NONE;
if (status & NI6527_STATUS_EDGE) { if (status & NI6527_STATUS_EDGE) {
comedi_buf_write_samples(s, &s->state, 1); unsigned short val = 0;
comedi_buf_write_samples(s, &val, 1);
comedi_handle_events(dev, s); comedi_handle_events(dev, s);
} }
......
...@@ -472,6 +472,7 @@ static irqreturn_t ni_65xx_interrupt(int irq, void *d) ...@@ -472,6 +472,7 @@ static irqreturn_t ni_65xx_interrupt(int irq, void *d)
struct comedi_device *dev = d; struct comedi_device *dev = d;
struct comedi_subdevice *s = dev->read_subdev; struct comedi_subdevice *s = dev->read_subdev;
unsigned int status; unsigned int status;
unsigned short val = 0;
status = readb(dev->mmio + NI_65XX_STATUS_REG); status = readb(dev->mmio + NI_65XX_STATUS_REG);
if ((status & NI_65XX_STATUS_INT) == 0) if ((status & NI_65XX_STATUS_INT) == 0)
...@@ -482,7 +483,7 @@ static irqreturn_t ni_65xx_interrupt(int irq, void *d) ...@@ -482,7 +483,7 @@ static irqreturn_t ni_65xx_interrupt(int irq, void *d)
writeb(NI_65XX_CLR_EDGE_INT | NI_65XX_CLR_OVERFLOW_INT, writeb(NI_65XX_CLR_EDGE_INT | NI_65XX_CLR_OVERFLOW_INT,
dev->mmio + NI_65XX_CLR_REG); dev->mmio + NI_65XX_CLR_REG);
comedi_buf_write_samples(s, &s->state, 1); comedi_buf_write_samples(s, &val, 1);
comedi_handle_events(dev, s); comedi_handle_events(dev, s);
return IRQ_HANDLED; return IRQ_HANDLED;
......
...@@ -184,7 +184,7 @@ static irqreturn_t pcl711_interrupt(int irq, void *d) ...@@ -184,7 +184,7 @@ static irqreturn_t pcl711_interrupt(int irq, void *d)
struct comedi_device *dev = d; struct comedi_device *dev = d;
struct comedi_subdevice *s = dev->read_subdev; struct comedi_subdevice *s = dev->read_subdev;
struct comedi_cmd *cmd = &s->async->cmd; struct comedi_cmd *cmd = &s->async->cmd;
unsigned int data; unsigned short data;
if (!dev->attached) { if (!dev->attached) {
dev_err(dev->class_dev, "spurious interrupt\n"); dev_err(dev->class_dev, "spurious interrupt\n");
......
...@@ -220,9 +220,11 @@ static irqreturn_t pcl726_interrupt(int irq, void *d) ...@@ -220,9 +220,11 @@ static irqreturn_t pcl726_interrupt(int irq, void *d)
struct pcl726_private *devpriv = dev->private; struct pcl726_private *devpriv = dev->private;
if (devpriv->cmd_running) { if (devpriv->cmd_running) {
unsigned short val = 0;
pcl726_intr_cancel(dev, s); pcl726_intr_cancel(dev, s);
comedi_buf_write_samples(s, &s->state, 1); comedi_buf_write_samples(s, &val, 1);
comedi_handle_events(dev, s); comedi_handle_events(dev, s);
} }
......
...@@ -423,7 +423,7 @@ static int pcl818_ai_eoc(struct comedi_device *dev, ...@@ -423,7 +423,7 @@ static int pcl818_ai_eoc(struct comedi_device *dev,
static bool pcl818_ai_write_sample(struct comedi_device *dev, static bool pcl818_ai_write_sample(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
unsigned int chan, unsigned int val) unsigned int chan, unsigned short val)
{ {
struct pcl818_private *devpriv = dev->private; struct pcl818_private *devpriv = dev->private;
struct comedi_cmd *cmd = &s->async->cmd; struct comedi_cmd *cmd = &s->async->cmd;
......
...@@ -1120,6 +1120,7 @@ static int ks_wlan_set_scan(struct net_device *dev, ...@@ -1120,6 +1120,7 @@ static int ks_wlan_set_scan(struct net_device *dev,
{ {
struct ks_wlan_private *priv = netdev_priv(dev); struct ks_wlan_private *priv = netdev_priv(dev);
struct iw_scan_req *req = NULL; struct iw_scan_req *req = NULL;
int len;
if (priv->sleep_mode == SLP_SLEEP) if (priv->sleep_mode == SLP_SLEEP)
return -EPERM; return -EPERM;
...@@ -1129,8 +1130,9 @@ static int ks_wlan_set_scan(struct net_device *dev, ...@@ -1129,8 +1130,9 @@ static int ks_wlan_set_scan(struct net_device *dev,
if (wrqu->data.length == sizeof(struct iw_scan_req) && if (wrqu->data.length == sizeof(struct iw_scan_req) &&
wrqu->data.flags & IW_SCAN_THIS_ESSID) { wrqu->data.flags & IW_SCAN_THIS_ESSID) {
req = (struct iw_scan_req *)extra; req = (struct iw_scan_req *)extra;
priv->scan_ssid_len = req->essid_len; len = min_t(int, req->essid_len, IW_ESSID_MAX_SIZE);
memcpy(priv->scan_ssid, req->essid, priv->scan_ssid_len); priv->scan_ssid_len = len;
memcpy(priv->scan_ssid, req->essid, len);
} else { } else {
priv->scan_ssid_len = 0; priv->scan_ssid_len = 0;
} }
......
...@@ -791,6 +791,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) ...@@ -791,6 +791,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, WLAN_EID_SSID, &ie_len, p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, WLAN_EID_SSID, &ie_len,
pbss_network->ie_length - _BEACON_IE_OFFSET_); pbss_network->ie_length - _BEACON_IE_OFFSET_);
if (p && ie_len > 0) { if (p && ie_len > 0) {
ie_len = min_t(int, ie_len, sizeof(pbss_network->ssid.ssid));
memset(&pbss_network->ssid, 0, sizeof(struct ndis_802_11_ssid)); memset(&pbss_network->ssid, 0, sizeof(struct ndis_802_11_ssid));
memcpy(pbss_network->ssid.ssid, p + 2, ie_len); memcpy(pbss_network->ssid.ssid, p + 2, ie_len);
pbss_network->ssid.ssid_length = ie_len; pbss_network->ssid.ssid_length = ie_len;
...@@ -811,6 +812,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) ...@@ -811,6 +812,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, WLAN_EID_SUPP_RATES, &ie_len, p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, WLAN_EID_SUPP_RATES, &ie_len,
pbss_network->ie_length - _BEACON_IE_OFFSET_); pbss_network->ie_length - _BEACON_IE_OFFSET_);
if (p) { if (p) {
ie_len = min_t(int, ie_len, NDIS_802_11_LENGTH_RATES_EX);
memcpy(supportRate, p + 2, ie_len); memcpy(supportRate, p + 2, ie_len);
supportRateNum = ie_len; supportRateNum = ie_len;
} }
...@@ -819,6 +821,8 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) ...@@ -819,6 +821,8 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, WLAN_EID_EXT_SUPP_RATES, p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, WLAN_EID_EXT_SUPP_RATES,
&ie_len, pbss_network->ie_length - _BEACON_IE_OFFSET_); &ie_len, pbss_network->ie_length - _BEACON_IE_OFFSET_);
if (p) { if (p) {
ie_len = min_t(int, ie_len,
NDIS_802_11_LENGTH_RATES_EX - supportRateNum);
memcpy(supportRate + supportRateNum, p + 2, ie_len); memcpy(supportRate + supportRateNum, p + 2, ie_len);
supportRateNum += ie_len; supportRateNum += ie_len;
} }
...@@ -934,6 +938,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) ...@@ -934,6 +938,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
pht_cap->mcs.rx_mask[0] = 0xff; pht_cap->mcs.rx_mask[0] = 0xff;
pht_cap->mcs.rx_mask[1] = 0x0; pht_cap->mcs.rx_mask[1] = 0x0;
ie_len = min_t(int, ie_len, sizeof(pmlmepriv->htpriv.ht_cap));
memcpy(&pmlmepriv->htpriv.ht_cap, p + 2, ie_len); memcpy(&pmlmepriv->htpriv.ht_cap, p + 2, ie_len);
} }
......
...@@ -1133,9 +1133,11 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, ...@@ -1133,9 +1133,11 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
break; break;
} }
sec_len = *(pos++); len -= 1; sec_len = *(pos++); len -= 1;
if (sec_len > 0 && sec_len <= len) { if (sec_len > 0 &&
sec_len <= len &&
sec_len <= 32) {
ssid[ssid_index].ssid_length = sec_len; ssid[ssid_index].ssid_length = sec_len;
memcpy(ssid[ssid_index].ssid, pos, ssid[ssid_index].ssid_length); memcpy(ssid[ssid_index].ssid, pos, sec_len);
ssid_index++; ssid_index++;
} }
pos += sec_len; pos += sec_len;
......
...@@ -27,6 +27,7 @@ config RTLLIB_CRYPTO_CCMP ...@@ -27,6 +27,7 @@ config RTLLIB_CRYPTO_CCMP
config RTLLIB_CRYPTO_TKIP config RTLLIB_CRYPTO_TKIP
tristate "Support for rtllib TKIP crypto" tristate "Support for rtllib TKIP crypto"
depends on RTLLIB depends on RTLLIB
select CRYPTO
select CRYPTO_LIB_ARC4 select CRYPTO_LIB_ARC4
select CRYPTO_MICHAEL_MIC select CRYPTO_MICHAEL_MIC
default y default y
......
...@@ -406,9 +406,10 @@ static int _rtl92e_wx_set_scan(struct net_device *dev, ...@@ -406,9 +406,10 @@ static int _rtl92e_wx_set_scan(struct net_device *dev,
struct iw_scan_req *req = (struct iw_scan_req *)b; struct iw_scan_req *req = (struct iw_scan_req *)b;
if (req->essid_len) { if (req->essid_len) {
ieee->current_network.ssid_len = req->essid_len; int len = min_t(int, req->essid_len, IW_ESSID_MAX_SIZE);
memcpy(ieee->current_network.ssid, req->essid,
req->essid_len); ieee->current_network.ssid_len = len;
memcpy(ieee->current_network.ssid, req->essid, len);
} }
} }
......
...@@ -331,8 +331,10 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, ...@@ -331,8 +331,10 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
struct iw_scan_req *req = (struct iw_scan_req *)b; struct iw_scan_req *req = (struct iw_scan_req *)b;
if (req->essid_len) { if (req->essid_len) {
ieee->current_network.ssid_len = req->essid_len; int len = min_t(int, req->essid_len, IW_ESSID_MAX_SIZE);
memcpy(ieee->current_network.ssid, req->essid, req->essid_len);
ieee->current_network.ssid_len = len;
memcpy(ieee->current_network.ssid, req->essid, len);
} }
} }
......
...@@ -192,8 +192,10 @@ u8 r8712_sitesurvey_cmd(struct _adapter *padapter, ...@@ -192,8 +192,10 @@ u8 r8712_sitesurvey_cmd(struct _adapter *padapter,
psurveyPara->ss_ssidlen = 0; psurveyPara->ss_ssidlen = 0;
memset(psurveyPara->ss_ssid, 0, IW_ESSID_MAX_SIZE + 1); memset(psurveyPara->ss_ssid, 0, IW_ESSID_MAX_SIZE + 1);
if (pssid && pssid->SsidLength) { if (pssid && pssid->SsidLength) {
memcpy(psurveyPara->ss_ssid, pssid->Ssid, pssid->SsidLength); int len = min_t(int, pssid->SsidLength, IW_ESSID_MAX_SIZE);
psurveyPara->ss_ssidlen = cpu_to_le32(pssid->SsidLength);
memcpy(psurveyPara->ss_ssid, pssid->Ssid, len);
psurveyPara->ss_ssidlen = cpu_to_le32(len);
} }
set_fwstate(pmlmepriv, _FW_UNDER_SURVEY); set_fwstate(pmlmepriv, _FW_UNDER_SURVEY);
r8712_enqueue_cmd(pcmdpriv, ph2c); r8712_enqueue_cmd(pcmdpriv, ph2c);
......
...@@ -924,7 +924,7 @@ static int r871x_wx_set_priv(struct net_device *dev, ...@@ -924,7 +924,7 @@ static int r871x_wx_set_priv(struct net_device *dev,
struct iw_point *dwrq = (struct iw_point *)awrq; struct iw_point *dwrq = (struct iw_point *)awrq;
len = dwrq->length; len = dwrq->length;
ext = memdup_user(dwrq->pointer, len); ext = strndup_user(dwrq->pointer, len);
if (IS_ERR(ext)) if (IS_ERR(ext))
return PTR_ERR(ext); return PTR_ERR(ext);
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
* Copyright (c) 2010, ST-Ericsson * Copyright (c) 2010, ST-Ericsson
*/ */
#include <linux/gpio/consumer.h>
#include <net/mac80211.h> #include <net/mac80211.h>
#include "bh.h" #include "bh.h"
......
...@@ -8,6 +8,10 @@ ...@@ -8,6 +8,10 @@
#ifndef WFX_BH_H #ifndef WFX_BH_H
#define WFX_BH_H #define WFX_BH_H
#include <linux/atomic.h>
#include <linux/wait.h>
#include <linux/workqueue.h>
struct wfx_dev; struct wfx_dev;
struct wfx_hif { struct wfx_hif {
......
...@@ -8,6 +8,9 @@ ...@@ -8,6 +8,9 @@
#ifndef WFX_BUS_H #ifndef WFX_BUS_H
#define WFX_BUS_H #define WFX_BUS_H
#include <linux/mmc/sdio_func.h>
#include <linux/spi/spi.h>
#define WFX_REG_CONFIG 0x0 #define WFX_REG_CONFIG 0x0
#define WFX_REG_CONTROL 0x1 #define WFX_REG_CONTROL 0x1
#define WFX_REG_IN_OUT_QUEUE 0x2 #define WFX_REG_IN_OUT_QUEUE 0x2
......
...@@ -5,13 +5,19 @@ ...@@ -5,13 +5,19 @@
* Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
* Copyright (c) 2010, ST-Ericsson * Copyright (c) 2010, ST-Ericsson
*/ */
#include <linux/module.h>
#include <linux/mmc/sdio.h> #include <linux/mmc/sdio.h>
#include <linux/mmc/sdio_func.h> #include <linux/mmc/sdio_func.h>
#include <linux/mmc/card.h> #include <linux/mmc/card.h>
#include <linux/interrupt.h>
#include <linux/of_irq.h> #include <linux/of_irq.h>
#include <linux/irq.h>
#include "bus.h" #include "bus.h"
#include "wfx.h" #include "wfx.h"
#include "hwio.h"
#include "main.h"
#include "bh.h"
static const struct wfx_platform_data wfx_sdio_pdata = { static const struct wfx_platform_data wfx_sdio_pdata = {
.file_fw = "wfm_wf200", .file_fw = "wfm_wf200",
......
...@@ -6,12 +6,19 @@ ...@@ -6,12 +6,19 @@
* Copyright (c) 2011, Sagrad Inc. * Copyright (c) 2011, Sagrad Inc.
* Copyright (c) 2010, ST-Ericsson * Copyright (c) 2010, ST-Ericsson
*/ */
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/interrupt.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/of.h> #include <linux/of.h>
#include "bus.h" #include "bus.h"
#include "wfx.h" #include "wfx.h"
#include "hwio.h"
#include "main.h"
#include "bh.h"
#define SET_WRITE 0x7FFF /* usage: and operation */ #define SET_WRITE 0x7FFF /* usage: and operation */
#define SET_READ 0x8000 /* usage: or operation */ #define SET_READ 0x8000 /* usage: or operation */
......
...@@ -5,8 +5,13 @@ ...@@ -5,8 +5,13 @@
* Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
* Copyright (c) 2010, ST-Ericsson * Copyright (c) 2010, ST-Ericsson
*/ */
#include <linux/etherdevice.h>
#include <net/mac80211.h>
#include "data_rx.h" #include "data_rx.h"
#include "wfx.h" #include "wfx.h"
#include "bh.h"
#include "sta.h"
static void wfx_rx_handle_ba(struct wfx_vif *wvif, struct ieee80211_mgmt *mgmt) static void wfx_rx_handle_ba(struct wfx_vif *wvif, struct ieee80211_mgmt *mgmt)
{ {
......
...@@ -6,9 +6,14 @@ ...@@ -6,9 +6,14 @@
* Copyright (c) 2010, ST-Ericsson * Copyright (c) 2010, ST-Ericsson
*/ */
#include <net/mac80211.h> #include <net/mac80211.h>
#include <linux/etherdevice.h>
#include "data_tx.h"
#include "wfx.h" #include "wfx.h"
#include "bh.h"
#include "sta.h" #include "sta.h"
#include "queue.h"
#include "debug.h"
#include "traces.h" #include "traces.h"
#include "hif_tx_mib.h" #include "hif_tx_mib.h"
......
...@@ -8,6 +8,9 @@ ...@@ -8,6 +8,9 @@
#ifndef WFX_DATA_TX_H #ifndef WFX_DATA_TX_H
#define WFX_DATA_TX_H #define WFX_DATA_TX_H
#include <linux/list.h>
#include <net/mac80211.h>
#include "hif_api_cmd.h" #include "hif_api_cmd.h"
#include "hif_api_mib.h" #include "hif_api_mib.h"
......
...@@ -5,9 +5,15 @@ ...@@ -5,9 +5,15 @@
* Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
* Copyright (c) 2010, ST-Ericsson * Copyright (c) 2010, ST-Ericsson
*/ */
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/crc32.h>
#include "debug.h" #include "debug.h"
#include "wfx.h" #include "wfx.h"
#include "sta.h" #include "sta.h"
#include "main.h"
#include "hif_tx.h"
#include "hif_tx_mib.h" #include "hif_tx_mib.h"
#define CREATE_TRACE_POINTS #define CREATE_TRACE_POINTS
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
* Copyright (c) 2010, ST-Ericsson * Copyright (c) 2010, ST-Ericsson
*/ */
#include <linux/firmware.h> #include <linux/firmware.h>
#include <linux/slab.h>
#include <linux/mm.h>
#include <linux/bitfield.h> #include <linux/bitfield.h>
#include "fwio.h" #include "fwio.h"
......
...@@ -8,6 +8,10 @@ ...@@ -8,6 +8,10 @@
#ifndef WFX_HIF_API_CMD_H #ifndef WFX_HIF_API_CMD_H
#define WFX_HIF_API_CMD_H #define WFX_HIF_API_CMD_H
#include <linux/ieee80211.h>
#include "hif_api_general.h"
enum hif_requests_ids { enum hif_requests_ids {
HIF_REQ_ID_RESET = 0x0a, HIF_REQ_ID_RESET = 0x0a,
HIF_REQ_ID_READ_MIB = 0x05, HIF_REQ_ID_READ_MIB = 0x05,
......
...@@ -8,6 +8,15 @@ ...@@ -8,6 +8,15 @@
#ifndef WFX_HIF_API_GENERAL_H #ifndef WFX_HIF_API_GENERAL_H
#define WFX_HIF_API_GENERAL_H #define WFX_HIF_API_GENERAL_H
#ifdef __KERNEL__
#include <linux/types.h>
#include <linux/if_ether.h>
#else
#include <net/ethernet.h>
#include <stdint.h>
#define __packed __attribute__((__packed__))
#endif
#define HIF_ID_IS_INDICATION 0x80 #define HIF_ID_IS_INDICATION 0x80
#define HIF_COUNTER_MAX 7 #define HIF_COUNTER_MAX 7
......
...@@ -6,7 +6,11 @@ ...@@ -6,7 +6,11 @@
* Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
* Copyright (c) 2010, ST-Ericsson * Copyright (c) 2010, ST-Ericsson
*/ */
#include <linux/etherdevice.h>
#include "hif_tx.h"
#include "wfx.h" #include "wfx.h"
#include "bh.h"
#include "hwio.h" #include "hwio.h"
#include "debug.h" #include "debug.h"
#include "sta.h" #include "sta.h"
......
...@@ -6,8 +6,13 @@ ...@@ -6,8 +6,13 @@
* Copyright (c) 2010, ST-Ericsson * Copyright (c) 2010, ST-Ericsson
* Copyright (C) 2010, ST-Ericsson SA * Copyright (C) 2010, ST-Ericsson SA
*/ */
#include <linux/etherdevice.h>
#include "wfx.h" #include "wfx.h"
#include "hif_tx.h"
#include "hif_tx_mib.h" #include "hif_tx_mib.h"
#include "hif_api_mib.h"
int hif_set_output_power(struct wfx_vif *wvif, int val) int hif_set_output_power(struct wfx_vif *wvif, int val)
{ {
......
...@@ -5,10 +5,13 @@ ...@@ -5,10 +5,13 @@
* Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
* Copyright (c) 2010, ST-Ericsson * Copyright (c) 2010, ST-Ericsson
*/ */
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/slab.h> #include <linux/slab.h>
#include "hwio.h" #include "hwio.h"
#include "wfx.h" #include "wfx.h"
#include "bus.h"
#include "traces.h" #include "traces.h"
/* /*
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#ifndef WFX_HWIO_H #ifndef WFX_HWIO_H
#define WFX_HWIO_H #define WFX_HWIO_H
#include <linux/types.h>
struct wfx_dev; struct wfx_dev;
int wfx_data_read(struct wfx_dev *wdev, void *buf, size_t buf_len); int wfx_data_read(struct wfx_dev *wdev, void *buf, size_t buf_len);
......
...@@ -5,10 +5,12 @@ ...@@ -5,10 +5,12 @@
* Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
* Copyright (c) 2010, ST-Ericsson * Copyright (c) 2010, ST-Ericsson
*/ */
#include <linux/etherdevice.h>
#include <net/mac80211.h> #include <net/mac80211.h>
#include "key.h" #include "key.h"
#include "wfx.h" #include "wfx.h"
#include "hif_tx_mib.h"
static int wfx_alloc_key(struct wfx_dev *wdev) static int wfx_alloc_key(struct wfx_dev *wdev)
{ {
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#ifndef WFX_KEY_H #ifndef WFX_KEY_H
#define WFX_KEY_H #define WFX_KEY_H
#include <net/mac80211.h>
struct wfx_dev; struct wfx_dev;
struct wfx_vif; struct wfx_vif;
......
...@@ -10,21 +10,28 @@ ...@@ -10,21 +10,28 @@
* Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net> * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
* Copyright (c) 2004-2006 Jean-Baptiste Note <jbnote@gmail.com>, et al. * Copyright (c) 2004-2006 Jean-Baptiste Note <jbnote@gmail.com>, et al.
*/ */
#include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_net.h> #include <linux/of_net.h>
#include <linux/gpio/consumer.h>
#include <linux/mmc/sdio_func.h> #include <linux/mmc/sdio_func.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/etherdevice.h>
#include <linux/firmware.h> #include <linux/firmware.h>
#include "main.h"
#include "wfx.h" #include "wfx.h"
#include "fwio.h" #include "fwio.h"
#include "hwio.h" #include "hwio.h"
#include "bus.h" #include "bus.h"
#include "bh.h"
#include "sta.h" #include "sta.h"
#include "key.h" #include "key.h"
#include "scan.h" #include "scan.h"
#include "debug.h" #include "debug.h"
#include "data_tx.h"
#include "hif_tx_mib.h" #include "hif_tx_mib.h"
#include "hif_api_cmd.h"
#define WFX_PDS_MAX_SIZE 1500 #define WFX_PDS_MAX_SIZE 1500
......
...@@ -10,8 +10,11 @@ ...@@ -10,8 +10,11 @@
#ifndef WFX_MAIN_H #ifndef WFX_MAIN_H
#define WFX_MAIN_H #define WFX_MAIN_H
#include <linux/device.h>
#include <linux/gpio/consumer.h> #include <linux/gpio/consumer.h>
#include "hif_api_general.h"
struct wfx_dev; struct wfx_dev;
struct hwbus_ops; struct hwbus_ops;
......
...@@ -5,9 +5,13 @@ ...@@ -5,9 +5,13 @@
* Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
* Copyright (c) 2010, ST-Ericsson * Copyright (c) 2010, ST-Ericsson
*/ */
#include <linux/sched.h>
#include <net/mac80211.h> #include <net/mac80211.h>
#include "queue.h"
#include "wfx.h" #include "wfx.h"
#include "sta.h"
#include "data_tx.h"
#include "traces.h" #include "traces.h"
void wfx_tx_lock(struct wfx_dev *wdev) void wfx_tx_lock(struct wfx_dev *wdev)
......
...@@ -8,6 +8,9 @@ ...@@ -8,6 +8,9 @@
#ifndef WFX_QUEUE_H #ifndef WFX_QUEUE_H
#define WFX_QUEUE_H #define WFX_QUEUE_H
#include <linux/skbuff.h>
#include <linux/atomic.h>
struct wfx_dev; struct wfx_dev;
struct wfx_vif; struct wfx_vif;
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#ifndef WFX_SCAN_H #ifndef WFX_SCAN_H
#define WFX_SCAN_H #define WFX_SCAN_H
#include <net/mac80211.h>
struct wfx_dev; struct wfx_dev;
struct wfx_vif; struct wfx_vif;
......
...@@ -5,11 +5,17 @@ ...@@ -5,11 +5,17 @@
* Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
* Copyright (c) 2010, ST-Ericsson * Copyright (c) 2010, ST-Ericsson
*/ */
#include <linux/etherdevice.h>
#include <net/mac80211.h> #include <net/mac80211.h>
#include "sta.h" #include "sta.h"
#include "wfx.h" #include "wfx.h"
#include "fwio.h"
#include "bh.h"
#include "key.h"
#include "scan.h" #include "scan.h"
#include "debug.h"
#include "hif_tx.h"
#include "hif_tx_mib.h" #include "hif_tx_mib.h"
#define HIF_MAX_ARP_IP_ADDRTABLE_ENTRIES 2 #define HIF_MAX_ARP_IP_ADDRTABLE_ENTRIES 2
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#ifndef WFX_STA_H #ifndef WFX_STA_H
#define WFX_STA_H #define WFX_STA_H
#include <net/mac80211.h>
struct wfx_dev; struct wfx_dev;
struct wfx_vif; struct wfx_vif;
......
...@@ -12,8 +12,11 @@ ...@@ -12,8 +12,11 @@
#define _WFX_TRACE_H #define _WFX_TRACE_H
#include <linux/tracepoint.h> #include <linux/tracepoint.h>
#include <net/mac80211.h>
#include "bus.h" #include "bus.h"
#include "hif_api_cmd.h"
#include "hif_api_mib.h"
/* The hell below need some explanations. For each symbolic number, we need to /* The hell below need some explanations. For each symbolic number, we need to
* define it with TRACE_DEFINE_ENUM() and in a list for __print_symbolic. * define it with TRACE_DEFINE_ENUM() and in a list for __print_symbolic.
......
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
#ifndef WFX_H #ifndef WFX_H
#define WFX_H #define WFX_H
#include <linux/completion.h>
#include <linux/workqueue.h>
#include <linux/mutex.h>
#include <linux/nospec.h> #include <linux/nospec.h>
#include <net/mac80211.h> #include <net/mac80211.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment