Commit f208a76f authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'staging-5.8-rc7' of...

Merge tag 'staging-5.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging into master

Pull staging driver fixes from Greg KH:
 "Five small staging driver fixes for 5.8-rc7 to resolve some reported
  problems:

   - four comedi driver fixes for problems found with them

   - a syzbot-found fix for the wlang-ng driver that resolves a much
     reported problem.

  All of these have been in linux-next with no reported issues"

* tag 'staging-5.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  staging: wlan-ng: properly check endpoint types
  staging: comedi: addi_apci_1564: check INSN_CONFIG_DIGITAL_TRIG shift
  staging: comedi: addi_apci_1500: check INSN_CONFIG_DIGITAL_TRIG shift
  staging: comedi: addi_apci_1032: check INSN_CONFIG_DIGITAL_TRIG shift
  staging: comedi: ni_6527: fix INSN_CONFIG_DIGITAL_TRIG support
parents 7d22af6c faaff976
...@@ -106,14 +106,22 @@ static int apci1032_cos_insn_config(struct comedi_device *dev, ...@@ -106,14 +106,22 @@ static int apci1032_cos_insn_config(struct comedi_device *dev,
unsigned int *data) unsigned int *data)
{ {
struct apci1032_private *devpriv = dev->private; struct apci1032_private *devpriv = dev->private;
unsigned int shift, oldmask; unsigned int shift, oldmask, himask, lomask;
switch (data[0]) { switch (data[0]) {
case INSN_CONFIG_DIGITAL_TRIG: case INSN_CONFIG_DIGITAL_TRIG:
if (data[1] != 0) if (data[1] != 0)
return -EINVAL; return -EINVAL;
shift = data[3]; shift = data[3];
if (shift < 32) {
oldmask = (1U << shift) - 1; oldmask = (1U << shift) - 1;
himask = data[4] << shift;
lomask = data[5] << shift;
} else {
oldmask = 0xffffffffu;
himask = 0;
lomask = 0;
}
switch (data[2]) { switch (data[2]) {
case COMEDI_DIGITAL_TRIG_DISABLE: case COMEDI_DIGITAL_TRIG_DISABLE:
devpriv->ctrl = 0; devpriv->ctrl = 0;
...@@ -136,8 +144,8 @@ static int apci1032_cos_insn_config(struct comedi_device *dev, ...@@ -136,8 +144,8 @@ static int apci1032_cos_insn_config(struct comedi_device *dev,
devpriv->mode2 &= oldmask; devpriv->mode2 &= oldmask;
} }
/* configure specified channels */ /* configure specified channels */
devpriv->mode1 |= data[4] << shift; devpriv->mode1 |= himask;
devpriv->mode2 |= data[5] << shift; devpriv->mode2 |= lomask;
break; break;
case COMEDI_DIGITAL_TRIG_ENABLE_LEVELS: case COMEDI_DIGITAL_TRIG_ENABLE_LEVELS:
if (devpriv->ctrl != (APCI1032_CTRL_INT_ENA | if (devpriv->ctrl != (APCI1032_CTRL_INT_ENA |
...@@ -154,8 +162,8 @@ static int apci1032_cos_insn_config(struct comedi_device *dev, ...@@ -154,8 +162,8 @@ static int apci1032_cos_insn_config(struct comedi_device *dev,
devpriv->mode2 &= oldmask; devpriv->mode2 &= oldmask;
} }
/* configure specified channels */ /* configure specified channels */
devpriv->mode1 |= data[4] << shift; devpriv->mode1 |= himask;
devpriv->mode2 |= data[5] << shift; devpriv->mode2 |= lomask;
break; break;
default: default:
return -EINVAL; return -EINVAL;
......
...@@ -452,13 +452,14 @@ static int apci1500_di_cfg_trig(struct comedi_device *dev, ...@@ -452,13 +452,14 @@ static int apci1500_di_cfg_trig(struct comedi_device *dev,
struct apci1500_private *devpriv = dev->private; struct apci1500_private *devpriv = dev->private;
unsigned int trig = data[1]; unsigned int trig = data[1];
unsigned int shift = data[3]; unsigned int shift = data[3];
unsigned int hi_mask = data[4] << shift; unsigned int hi_mask;
unsigned int lo_mask = data[5] << shift; unsigned int lo_mask;
unsigned int chan_mask = hi_mask | lo_mask; unsigned int chan_mask;
unsigned int old_mask = (1 << shift) - 1; unsigned int old_mask;
unsigned int pm; unsigned int pm;
unsigned int pt; unsigned int pt;
unsigned int pp; unsigned int pp;
unsigned int invalid_chan;
if (trig > 1) { if (trig > 1) {
dev_dbg(dev->class_dev, dev_dbg(dev->class_dev,
...@@ -466,7 +467,20 @@ static int apci1500_di_cfg_trig(struct comedi_device *dev, ...@@ -466,7 +467,20 @@ static int apci1500_di_cfg_trig(struct comedi_device *dev,
return -EINVAL; return -EINVAL;
} }
if (chan_mask > 0xffff) { if (shift <= 16) {
hi_mask = data[4] << shift;
lo_mask = data[5] << shift;
old_mask = (1U << shift) - 1;
invalid_chan = (data[4] | data[5]) >> (16 - shift);
} else {
hi_mask = 0;
lo_mask = 0;
old_mask = 0xffff;
invalid_chan = data[4] | data[5];
}
chan_mask = hi_mask | lo_mask;
if (invalid_chan) {
dev_dbg(dev->class_dev, "invalid digital trigger channel\n"); dev_dbg(dev->class_dev, "invalid digital trigger channel\n");
return -EINVAL; return -EINVAL;
} }
......
...@@ -331,14 +331,22 @@ static int apci1564_cos_insn_config(struct comedi_device *dev, ...@@ -331,14 +331,22 @@ static int apci1564_cos_insn_config(struct comedi_device *dev,
unsigned int *data) unsigned int *data)
{ {
struct apci1564_private *devpriv = dev->private; struct apci1564_private *devpriv = dev->private;
unsigned int shift, oldmask; unsigned int shift, oldmask, himask, lomask;
switch (data[0]) { switch (data[0]) {
case INSN_CONFIG_DIGITAL_TRIG: case INSN_CONFIG_DIGITAL_TRIG:
if (data[1] != 0) if (data[1] != 0)
return -EINVAL; return -EINVAL;
shift = data[3]; shift = data[3];
if (shift < 32) {
oldmask = (1U << shift) - 1; oldmask = (1U << shift) - 1;
himask = data[4] << shift;
lomask = data[5] << shift;
} else {
oldmask = 0xffffffffu;
himask = 0;
lomask = 0;
}
switch (data[2]) { switch (data[2]) {
case COMEDI_DIGITAL_TRIG_DISABLE: case COMEDI_DIGITAL_TRIG_DISABLE:
devpriv->ctrl = 0; devpriv->ctrl = 0;
...@@ -362,8 +370,8 @@ static int apci1564_cos_insn_config(struct comedi_device *dev, ...@@ -362,8 +370,8 @@ static int apci1564_cos_insn_config(struct comedi_device *dev,
devpriv->mode2 &= oldmask; devpriv->mode2 &= oldmask;
} }
/* configure specified channels */ /* configure specified channels */
devpriv->mode1 |= data[4] << shift; devpriv->mode1 |= himask;
devpriv->mode2 |= data[5] << shift; devpriv->mode2 |= lomask;
break; break;
case COMEDI_DIGITAL_TRIG_ENABLE_LEVELS: case COMEDI_DIGITAL_TRIG_ENABLE_LEVELS:
if (devpriv->ctrl != (APCI1564_DI_IRQ_ENA | if (devpriv->ctrl != (APCI1564_DI_IRQ_ENA |
...@@ -380,8 +388,8 @@ static int apci1564_cos_insn_config(struct comedi_device *dev, ...@@ -380,8 +388,8 @@ static int apci1564_cos_insn_config(struct comedi_device *dev,
devpriv->mode2 &= oldmask; devpriv->mode2 &= oldmask;
} }
/* configure specified channels */ /* configure specified channels */
devpriv->mode1 |= data[4] << shift; devpriv->mode1 |= himask;
devpriv->mode2 |= data[5] << shift; devpriv->mode2 |= lomask;
break; break;
default: default:
return -EINVAL; return -EINVAL;
......
...@@ -332,7 +332,7 @@ static int ni6527_intr_insn_config(struct comedi_device *dev, ...@@ -332,7 +332,7 @@ static int ni6527_intr_insn_config(struct comedi_device *dev,
case COMEDI_DIGITAL_TRIG_ENABLE_EDGES: case COMEDI_DIGITAL_TRIG_ENABLE_EDGES:
/* check shift amount */ /* check shift amount */
shift = data[3]; shift = data[3];
if (shift >= s->n_chan) { if (shift >= 32) {
mask = 0; mask = 0;
rising = 0; rising = 0;
falling = 0; falling = 0;
......
...@@ -61,11 +61,25 @@ static int prism2sta_probe_usb(struct usb_interface *interface, ...@@ -61,11 +61,25 @@ static int prism2sta_probe_usb(struct usb_interface *interface,
const struct usb_device_id *id) const struct usb_device_id *id)
{ {
struct usb_device *dev; struct usb_device *dev;
const struct usb_endpoint_descriptor *epd;
const struct usb_host_interface *iface_desc = interface->cur_altsetting;
struct wlandevice *wlandev = NULL; struct wlandevice *wlandev = NULL;
struct hfa384x *hw = NULL; struct hfa384x *hw = NULL;
int result = 0; int result = 0;
if (iface_desc->desc.bNumEndpoints != 2) {
result = -ENODEV;
goto failed;
}
result = -EINVAL;
epd = &iface_desc->endpoint[1].desc;
if (!usb_endpoint_is_bulk_in(epd))
goto failed;
epd = &iface_desc->endpoint[2].desc;
if (!usb_endpoint_is_bulk_out(epd))
goto failed;
dev = interface_to_usbdev(interface); dev = interface_to_usbdev(interface);
wlandev = create_wlan(); wlandev = create_wlan();
if (!wlandev) { if (!wlandev) {
......
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