Re:Confirm Receipt of My Message

2018-06-23 Thread Mrs.X
Dear Respectfully,

My name is Abla Yusuf from Syria,please i need your urgent assistance to help 
me and my two daughters relocate out of Syria because of the recent bombing by 
president Trump and his intentions to bomb more..I need you to help us relocate 
including our belongings and funds for we are good people and would not like to 
be treated as refugees and we have the cash to buy a new house , good school 
for my kids and a good business for us to start a new life ..Please help us.My 
Email:ablahyus...@gmail.com

Yours Sincerely
Ablah Yusuf
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: UDC ep0 desc or no desc

2018-06-23 Thread Alan Stern
On Sat, 23 Jun 2018, Benjamin Herrenschmidt wrote:

> Hi folks !
> 
> I noticed some UDC drivers setup a "desc" pointer for ep0.desc for the
> driver, some don't.
> 
> Is it officially needed ?

No, it isn't.  The only "core" routine that requires a desc pointer in 
the endpoint structure is usb_ep_enable, and that routine explicitly 
says it may not be called for ep0.

> Additionally some UCDs NULL out the desc pointer in ep_disable, is that
> also a requirement ?

No.  A disabled endpoint doesn't have any requirements on its 
descriptor or lack thereof.

> I somewhat fear that if somebody calls stuff like usb_ep_align() on ep0
> it will crash without a valid desc pointer...

That would be a pretty strange thing to do.  I'd say it's not worth 
worrying about until somebody makes that mistake.

> That leads me to wonder, should we sprinkle null checks (and maybe
> WARN_ON_ONCE) on some of those accessors to catch those cases ?

I think segmentation faults will do a good job of catching them.  :-)

Alan Stern

> I notices a few reports (and I'm about to debug one with my own UDC,
> aspeed vhub when I'm back at work on Monday, with HID) where we get a
> crash with a NULL dereference and while I don't know for sure yet
> that's the problem, the fact that EP0 has a NULL desc with most UDCs
> and that we clear the desc on EP disablement somewhat tickles me the
> wrong way...
> 
> Cheers,
> Ben.
> 
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: serial: qcserial: add support for the Dell DW5821e module

2018-06-23 Thread Aleksander Morgado
This module exposes two USB configurations: a QMI+AT capable setup on
USB config #1 and a MBIM capable setup on USB config #2.

By default the kernel will choose the MBIM capable configuration as
long as the cdc_mbim driver is available. This patch adds support for
the serial ports in the secondary configuration.

Signed-off-by: Aleksander Morgado 
---
 drivers/usb/serial/qcserial.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index 613f91add03d..ed109c86e747 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -177,6 +177,7 @@ static const struct usb_device_id id_table[] = {
{DEVICE_SWI(0x413c, 0x81d0)},   /* Dell Wireless 5819 */
{DEVICE_SWI(0x413c, 0x81d1)},   /* Dell Wireless 5818 */
{DEVICE_SWI(0x413c, 0x81d2)},   /* Dell Wireless 5818 */
+   {DEVICE_SWI(0x413c, 0x81d7)},   /* Dell Wireless 5821e */
 
/* Huawei devices */
{DEVICE_HWI(0x03f0, 0x581d)},   /* HP lt4112 LTE/HSPA+ Gobi 4G Modem 
(Huawei me906e) */
-- 
2.17.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/12] usb: serial: cyberjack: use irqsave() in USB's complete callback

2018-06-23 Thread Sebastian Andrzej Siewior
From: John Ogness 

The USB completion callback does not disable interrupts while acquiring
the lock. We want to remove the local_irq_disable() invocation from
__usb_hcd_giveback_urb() and therefore it is required for the callback
handler to disable the interrupts while acquiring the lock.
The callback may be invoked either in IRQ or BH context depending on the
USB host controller.
Use the _irqsave() variant of the locking primitives.

Cc: Johan Hovold 
Cc: Greg Kroah-Hartman 
Signed-off-by: John Ogness 
Signed-off-by: Sebastian Andrzej Siewior 
---
 drivers/usb/serial/cyberjack.c | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c
index dc67a2eb98d7..ebd76ab07b72 100644
--- a/drivers/usb/serial/cyberjack.c
+++ b/drivers/usb/serial/cyberjack.c
@@ -255,6 +255,7 @@ static void cyberjack_read_int_callback(struct urb *urb)
struct device *dev = &port->dev;
unsigned char *data = urb->transfer_buffer;
int status = urb->status;
+   unsigned long flags;
int result;
 
/* the urb might have been killed. */
@@ -270,13 +271,13 @@ static void cyberjack_read_int_callback(struct urb *urb)
/* This is a announcement of coming bulk_ins. */
unsigned short size = ((unsigned short)data[3]<<8)+data[2]+3;
 
-   spin_lock(&priv->lock);
+   spin_lock_irqsave(&priv->lock, flags);
 
old_rdtodo = priv->rdtodo;
 
if (old_rdtodo > SHRT_MAX - size) {
dev_dbg(dev, "To many bulk_in urbs to do.\n");
-   spin_unlock(&priv->lock);
+   spin_unlock_irqrestore(&priv->lock, flags);
goto resubmit;
}
 
@@ -285,7 +286,7 @@ static void cyberjack_read_int_callback(struct urb *urb)
 
dev_dbg(dev, "%s - rdtodo: %d\n", __func__, priv->rdtodo);
 
-   spin_unlock(&priv->lock);
+   spin_unlock_irqrestore(&priv->lock, flags);
 
if (!old_rdtodo) {
result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
@@ -309,6 +310,7 @@ static void cyberjack_read_bulk_callback(struct urb *urb)
struct cyberjack_private *priv = usb_get_serial_port_data(port);
struct device *dev = &port->dev;
unsigned char *data = urb->transfer_buffer;
+   unsigned long flags;
short todo;
int result;
int status = urb->status;
@@ -325,7 +327,7 @@ static void cyberjack_read_bulk_callback(struct urb *urb)
tty_flip_buffer_push(&port->port);
}
 
-   spin_lock(&priv->lock);
+   spin_lock_irqsave(&priv->lock, flags);
 
/* Reduce urbs to do by one. */
priv->rdtodo -= urb->actual_length;
@@ -334,7 +336,7 @@ static void cyberjack_read_bulk_callback(struct urb *urb)
priv->rdtodo = 0;
todo = priv->rdtodo;
 
-   spin_unlock(&priv->lock);
+   spin_unlock_irqrestore(&priv->lock, flags);
 
dev_dbg(dev, "%s - rdtodo: %d\n", __func__, todo);
 
@@ -354,6 +356,7 @@ static void cyberjack_write_bulk_callback(struct urb *urb)
struct cyberjack_private *priv = usb_get_serial_port_data(port);
struct device *dev = &port->dev;
int status = urb->status;
+   unsigned long flags;
 
set_bit(0, &port->write_urbs_free);
if (status) {
@@ -362,7 +365,7 @@ static void cyberjack_write_bulk_callback(struct urb *urb)
return;
}
 
-   spin_lock(&priv->lock);
+   spin_lock_irqsave(&priv->lock, flags);
 
/* only do something if we have more data to send */
if (priv->wrfilled) {
@@ -406,7 +409,7 @@ static void cyberjack_write_bulk_callback(struct urb *urb)
}
 
 exit:
-   spin_unlock(&priv->lock);
+   spin_unlock_irqrestore(&priv->lock, flags);
usb_serial_port_softint(port);
 }
 
-- 
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/12] usb: serial: io_edgeport: use irqsave() in USB's complete callback

2018-06-23 Thread Sebastian Andrzej Siewior
From: John Ogness 

The USB completion callback does not disable interrupts while acquiring
the lock. We want to remove the local_irq_disable() invocation from
__usb_hcd_giveback_urb() and therefore it is required for the callback
handler to disable the interrupts while acquiring the lock.
The callback may be invoked either in IRQ or BH context depending on the
USB host controller.
Use the _irqsave() variant of the locking primitives.

Cc: Johan Hovold 
Cc: Greg Kroah-Hartman 
Signed-off-by: John Ogness 
Signed-off-by: Sebastian Andrzej Siewior 
---
 drivers/usb/serial/io_edgeport.c | 17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 17283f4b4779..97c69d373ca6 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -648,6 +648,7 @@ static void edge_interrupt_callback(struct urb *urb)
struct usb_serial_port *port;
unsigned char *data = urb->transfer_buffer;
int length = urb->actual_length;
+   unsigned long flags;
int bytes_avail;
int position;
int txCredits;
@@ -679,7 +680,7 @@ static void edge_interrupt_callback(struct urb *urb)
if (length > 1) {
bytes_avail = data[0] | (data[1] << 8);
if (bytes_avail) {
-   spin_lock(&edge_serial->es_lock);
+   spin_lock_irqsave(&edge_serial->es_lock, flags);
edge_serial->rxBytesAvail += bytes_avail;
dev_dbg(dev,
"%s - bytes_avail=%d, rxBytesAvail=%d, 
read_in_progress=%d\n",
@@ -702,7 +703,8 @@ static void edge_interrupt_callback(struct urb *urb)
edge_serial->read_in_progress = 
false;
}
}
-   spin_unlock(&edge_serial->es_lock);
+   spin_unlock_irqrestore(&edge_serial->es_lock,
+  flags);
}
}
/* grab the txcredits for the ports if available */
@@ -715,9 +717,11 @@ static void edge_interrupt_callback(struct urb *urb)
port = edge_serial->serial->port[portNumber];
edge_port = usb_get_serial_port_data(port);
if (edge_port->open) {
-   spin_lock(&edge_port->ep_lock);
+   spin_lock_irqsave(&edge_port->ep_lock,
+ flags);
edge_port->txCredits += txCredits;
-   spin_unlock(&edge_port->ep_lock);
+   
spin_unlock_irqrestore(&edge_port->ep_lock,
+  flags);
dev_dbg(dev, "%s - txcredits for port%d 
= %d\n",
__func__, portNumber,
edge_port->txCredits);
@@ -758,6 +762,7 @@ static void edge_bulk_in_callback(struct urb *urb)
int retval;
__u16   raw_data_length;
int status = urb->status;
+   unsigned long flags;
 
if (status) {
dev_dbg(&urb->dev->dev, "%s - nonzero read bulk status 
received: %d\n",
@@ -777,7 +782,7 @@ static void edge_bulk_in_callback(struct urb *urb)
 
usb_serial_debug_data(dev, __func__, raw_data_length, data);
 
-   spin_lock(&edge_serial->es_lock);
+   spin_lock_irqsave(&edge_serial->es_lock, flags);
 
/* decrement our rxBytes available by the number that we just got */
edge_serial->rxBytesAvail -= raw_data_length;
@@ -801,7 +806,7 @@ static void edge_bulk_in_callback(struct urb *urb)
edge_serial->read_in_progress = false;
}
 
-   spin_unlock(&edge_serial->es_lock);
+   spin_unlock_irqrestore(&edge_serial->es_lock, flags);
 }
 
 
-- 
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/12] usb: serial: Use irqsave in USB's complete callback

2018-06-23 Thread Sebastian Andrzej Siewior
This is about using _irqsave() primitives in the completion callback in
order to get rid of local_irq_save() in __usb_hcd_giveback_urb().

Sebastian 

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/12] usb: serial: digi_acceleport: use irqsave() in USB's complete callback

2018-06-23 Thread Sebastian Andrzej Siewior
From: John Ogness 

The USB completion callback does not disable interrupts while acquiring
the lock. We want to remove the local_irq_disable() invocation from
__usb_hcd_giveback_urb() and therefore it is required for the callback
handler to disable the interrupts while acquiring the lock.
The callback may be invoked either in IRQ or BH context depending on the
USB host controller.
Use the _irqsave() variant of the locking primitives.

Cc: Johan Hovold 
Cc: Greg Kroah-Hartman 
Signed-off-by: John Ogness 
Signed-off-by: Sebastian Andrzej Siewior 
---
 drivers/usb/serial/digi_acceleport.c | 23 +--
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/serial/digi_acceleport.c 
b/drivers/usb/serial/digi_acceleport.c
index b0526786fb02..ae512fed08af 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -984,6 +984,7 @@ static void digi_write_bulk_callback(struct urb *urb)
struct usb_serial *serial;
struct digi_port *priv;
struct digi_serial *serial_priv;
+   unsigned long flags;
int ret = 0;
int status = urb->status;
 
@@ -1004,15 +1005,15 @@ static void digi_write_bulk_callback(struct urb *urb)
/* handle oob callback */
if (priv->dp_port_num == serial_priv->ds_oob_port_num) {
dev_dbg(&port->dev, "digi_write_bulk_callback: oob callback\n");
-   spin_lock(&priv->dp_port_lock);
+   spin_lock_irqsave(&priv->dp_port_lock, flags);
priv->dp_write_urb_in_use = 0;
wake_up_interruptible(&port->write_wait);
-   spin_unlock(&priv->dp_port_lock);
+   spin_unlock_irqrestore(&priv->dp_port_lock, flags);
return;
}
 
/* try to send any buffered data on this port */
-   spin_lock(&priv->dp_port_lock);
+   spin_lock_irqsave(&priv->dp_port_lock, flags);
priv->dp_write_urb_in_use = 0;
if (priv->dp_out_buf_len > 0) {
*((unsigned char *)(port->write_urb->transfer_buffer))
@@ -1035,7 +1036,7 @@ static void digi_write_bulk_callback(struct urb *urb)
/* lost the race in write_chan(). */
schedule_work(&priv->dp_wakeup_work);
 
-   spin_unlock(&priv->dp_port_lock);
+   spin_unlock_irqrestore(&priv->dp_port_lock, flags);
if (ret && ret != -EPERM)
dev_err_console(port,
"%s: usb_submit_urb failed, ret=%d, port=%d\n",
@@ -1381,6 +1382,7 @@ static int digi_read_inb_callback(struct urb *urb)
struct usb_serial_port *port = urb->context;
struct digi_port *priv = usb_get_serial_port_data(port);
unsigned char *buf = urb->transfer_buffer;
+   unsigned long flags;
int opcode;
int len;
int port_status;
@@ -1407,7 +1409,7 @@ static int digi_read_inb_callback(struct urb *urb)
return -1;
}
 
-   spin_lock(&priv->dp_port_lock);
+   spin_lock_irqsave(&priv->dp_port_lock, flags);
 
/* check for throttle; if set, do not resubmit read urb */
/* indicate the read chain needs to be restarted on unthrottle */
@@ -1444,7 +1446,7 @@ static int digi_read_inb_callback(struct urb *urb)
tty_flip_buffer_push(&port->port);
}
}
-   spin_unlock(&priv->dp_port_lock);
+   spin_unlock_irqrestore(&priv->dp_port_lock, flags);
 
if (opcode == DIGI_CMD_RECEIVE_DISABLE)
dev_dbg(&port->dev, "%s: got RECEIVE_DISABLE\n", __func__);
@@ -1474,6 +1476,7 @@ static int digi_read_oob_callback(struct urb *urb)
struct digi_port *priv = usb_get_serial_port_data(port);
unsigned char *buf = urb->transfer_buffer;
int opcode, line, status, val;
+   unsigned long flags;
int i;
unsigned int rts;
 
@@ -1506,7 +1509,7 @@ static int digi_read_oob_callback(struct urb *urb)
rts = C_CRTSCTS(tty);
 
if (tty && opcode == DIGI_CMD_READ_INPUT_SIGNALS) {
-   spin_lock(&priv->dp_port_lock);
+   spin_lock_irqsave(&priv->dp_port_lock, flags);
/* convert from digi flags to termiox flags */
if (val & DIGI_READ_INPUT_SIGNALS_CTS) {
priv->dp_modem_signals |= TIOCM_CTS;
@@ -1530,12 +1533,12 @@ static int digi_read_oob_callback(struct urb *urb)
else
priv->dp_modem_signals &= ~TIOCM_CD;
 
-   spin_unlock(&priv->dp_port_lock);
+   spin_unlock_irqrestore(&priv->dp_port_lock, flags);
} else if (opcode == DIGI_CMD_TRANSMIT_IDLE) {
-   spin_lock(&priv->dp_port_lock);
+   spin_lock_irqsave(&priv->dp_port_lock, flags);
priv->dp_transmit_idle = 1;
wake_up_interruptible(&priv-

[PATCH 08/12] usb: serial: sierra: disable irq's for portdata lock

2018-06-23 Thread Sebastian Andrzej Siewior
From: John Ogness 

The portdata spinlock can be taken in interrupt context (via
sierra_outdat_callback()).
Disable interrupts when taking the portdata spinlock.

Cc: Johan Hovold 
Cc: Greg Kroah-Hartman 
Signed-off-by: John Ogness 
Signed-off-by: Sebastian Andrzej Siewior 
---
 drivers/usb/serial/sierra.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index d189f953c891..55956a638f5b 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -770,9 +770,9 @@ static void sierra_close(struct usb_serial_port *port)
kfree(urb->transfer_buffer);
usb_free_urb(urb);
usb_autopm_put_interface_async(serial->interface);
-   spin_lock(&portdata->lock);
+   spin_lock_irq(&portdata->lock);
portdata->outstanding_urbs--;
-   spin_unlock(&portdata->lock);
+   spin_unlock_irq(&portdata->lock);
}
 
sierra_stop_rx_urbs(port);
-- 
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/12] usb: serial: quatech2: use irqsave() in USB's complete callback

2018-06-23 Thread Sebastian Andrzej Siewior
From: John Ogness 

The USB completion callback does not disable interrupts while acquiring
the lock. We want to remove the local_irq_disable() invocation from
__usb_hcd_giveback_urb() and therefore it is required for the callback
handler to disable the interrupts while acquiring the lock.
The callback may be invoked either in IRQ or BH context depending on the
USB host controller.
Use the _irqsave() variant of the locking primitives.

Cc: Johan Hovold 
Cc: Greg Kroah-Hartman 
Signed-off-by: John Ogness 
Signed-off-by: Sebastian Andrzej Siewior 
---
 drivers/usb/serial/quatech2.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c
index 958e12e1e7c7..f7962982e204 100644
--- a/drivers/usb/serial/quatech2.c
+++ b/drivers/usb/serial/quatech2.c
@@ -621,16 +621,17 @@ static void qt2_write_bulk_callback(struct urb *urb)
 {
struct usb_serial_port *port;
struct qt2_port_private *port_priv;
+   unsigned long flags;
 
port = urb->context;
port_priv = usb_get_serial_port_data(port);
 
-   spin_lock(&port_priv->urb_lock);
+   spin_lock_irqsave(&port_priv->urb_lock, flags);
 
port_priv->urb_in_use = false;
usb_serial_port_softint(port);
 
-   spin_unlock(&port_priv->urb_lock);
+   spin_unlock_irqrestore(&port_priv->urb_lock, flags);
 
 }
 
-- 
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/12] usb: serial: mos7720: use irqsave() in USB's complete callback

2018-06-23 Thread Sebastian Andrzej Siewior
From: John Ogness 

The USB completion callback does not disable interrupts while acquiring
the lock. We want to remove the local_irq_disable() invocation from
__usb_hcd_giveback_urb() and therefore it is required for the callback
handler to disable the interrupts while acquiring the lock.
The callback may be invoked either in IRQ or BH context depending on the
USB host controller.
Use the _irqsave() variant of the locking primitives.

Cc: Johan Hovold 
Cc: Greg Kroah-Hartman 
Signed-off-by: John Ogness 
Signed-off-by: Sebastian Andrzej Siewior 
---
 drivers/usb/serial/mos7720.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index bd57630e67e2..8f11e759ad61 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -340,14 +340,15 @@ static void async_complete(struct urb *urb)
 {
struct urbtracker *urbtrack = urb->context;
int status = urb->status;
+   unsigned long flags;
 
if (unlikely(status))
dev_dbg(&urb->dev->dev, "%s - nonzero urb status received: 
%d\n", __func__, status);
 
/* remove the urbtracker from the active_urbs list */
-   spin_lock(&urbtrack->mos_parport->listlock);
+   spin_lock_irqsave(&urbtrack->mos_parport->listlock, flags);
list_del(&urbtrack->urblist_entry);
-   spin_unlock(&urbtrack->mos_parport->listlock);
+   spin_unlock_irqrestore(&urbtrack->mos_parport->listlock, flags);
kref_put(&urbtrack->ref_count, destroy_urbtracker);
 }
 
-- 
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/12] usb: serial: io_ti: use irqsave() in USB's complete callback

2018-06-23 Thread Sebastian Andrzej Siewior
From: John Ogness 

The USB completion callback does not disable interrupts while acquiring
the lock. We want to remove the local_irq_disable() invocation from
__usb_hcd_giveback_urb() and therefore it is required for the callback
handler to disable the interrupts while acquiring the lock.
The callback may be invoked either in IRQ or BH context depending on the
USB host controller.
Use the _irqsave() variant of the locking primitives.

Cc: Johan Hovold 
Cc: Greg Kroah-Hartman 
Signed-off-by: John Ogness 
Signed-off-by: Sebastian Andrzej Siewior 
---
 drivers/usb/serial/io_ti.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index 0fbadb37c104..6d1d6efa3055 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -1729,6 +1729,7 @@ static void edge_bulk_in_callback(struct urb *urb)
struct edgeport_port *edge_port = urb->context;
struct device *dev = &edge_port->port->dev;
unsigned char *data = urb->transfer_buffer;
+   unsigned long flags;
int retval = 0;
int port_number;
int status = urb->status;
@@ -1780,13 +1781,13 @@ static void edge_bulk_in_callback(struct urb *urb)
 
 exit:
/* continue read unless stopped */
-   spin_lock(&edge_port->ep_lock);
+   spin_lock_irqsave(&edge_port->ep_lock, flags);
if (edge_port->ep_read_urb_state == EDGE_READ_URB_RUNNING)
retval = usb_submit_urb(urb, GFP_ATOMIC);
else if (edge_port->ep_read_urb_state == EDGE_READ_URB_STOPPING)
edge_port->ep_read_urb_state = EDGE_READ_URB_STOPPED;
 
-   spin_unlock(&edge_port->ep_lock);
+   spin_unlock_irqrestore(&edge_port->ep_lock, flags);
if (retval)
dev_err(dev, "%s - usb_submit_urb failed with result %d\n", 
__func__, retval);
 }
-- 
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/12] usb: serial: sierra: use irqsave() in USB's complete callback

2018-06-23 Thread Sebastian Andrzej Siewior
From: John Ogness 

The USB completion callback does not disable interrupts while acquiring
the lock. We want to remove the local_irq_disable() invocation from
__usb_hcd_giveback_urb() and therefore it is required for the callback
handler to disable the interrupts while acquiring the lock.
The callback may be invoked either in IRQ or BH context depending on the
USB host controller.
Use the _irqsave() variant of the locking primitives.

Cc: Johan Hovold 
Cc: Greg Kroah-Hartman 
Signed-off-by: John Ogness 
Signed-off-by: Sebastian Andrzej Siewior 
---
 drivers/usb/serial/sierra.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 55956a638f5b..a43263a0edd8 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -409,6 +409,7 @@ static void sierra_outdat_callback(struct urb *urb)
struct sierra_port_private *portdata = usb_get_serial_port_data(port);
struct sierra_intf_private *intfdata;
int status = urb->status;
+   unsigned long flags;
 
intfdata = usb_get_serial_data(port->serial);
 
@@ -419,12 +420,12 @@ static void sierra_outdat_callback(struct urb *urb)
dev_dbg(&port->dev, "%s - nonzero write bulk status "
"received: %d\n", __func__, status);
 
-   spin_lock(&portdata->lock);
+   spin_lock_irqsave(&portdata->lock, flags);
--portdata->outstanding_urbs;
-   spin_unlock(&portdata->lock);
-   spin_lock(&intfdata->susp_lock);
+   spin_unlock_irqrestore(&portdata->lock, flags);
+   spin_lock_irqsave(&intfdata->susp_lock, flags);
--intfdata->in_flight;
-   spin_unlock(&intfdata->susp_lock);
+   spin_unlock_irqrestore(&intfdata->susp_lock, flags);
 
usb_serial_port_softint(port);
 }
-- 
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/12] usb: serial: usb_wwan: use irqsave() in USB's complete callback

2018-06-23 Thread Sebastian Andrzej Siewior
From: John Ogness 

The USB completion callback does not disable interrupts while acquiring
the lock. We want to remove the local_irq_disable() invocation from
__usb_hcd_giveback_urb() and therefore it is required for the callback
handler to disable the interrupts while acquiring the lock.
The callback may be invoked either in IRQ or BH context depending on the
USB host controller.
Use the _irqsave() variant of the locking primitives.

Cc: Johan Hovold 
Cc: Greg Kroah-Hartman 
Signed-off-by: John Ogness 
Signed-off-by: Sebastian Andrzej Siewior 
---
 drivers/usb/serial/usb_wwan.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index 107e64c42e94..912472f26e4f 100644
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -326,6 +326,7 @@ static void usb_wwan_outdat_callback(struct urb *urb)
struct usb_serial_port *port;
struct usb_wwan_port_private *portdata;
struct usb_wwan_intf_private *intfdata;
+   unsigned long flags;
int i;
 
port = urb->context;
@@ -334,9 +335,9 @@ static void usb_wwan_outdat_callback(struct urb *urb)
usb_serial_port_softint(port);
usb_autopm_put_interface_async(port->serial->interface);
portdata = usb_get_serial_port_data(port);
-   spin_lock(&intfdata->susp_lock);
+   spin_lock_irqsave(&intfdata->susp_lock, flags);
intfdata->in_flight--;
-   spin_unlock(&intfdata->susp_lock);
+   spin_unlock_irqrestore(&intfdata->susp_lock, flags);
 
for (i = 0; i < N_OUT_URB; ++i) {
if (portdata->out_urbs[i] == urb) {
-- 
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/12] usb: serial: ti_usb_3410_5052: use irqsave() in USB's complete callback

2018-06-23 Thread Sebastian Andrzej Siewior
From: John Ogness 

The USB completion callback does not disable interrupts while acquiring
the lock. We want to remove the local_irq_disable() invocation from
__usb_hcd_giveback_urb() and therefore it is required for the callback
handler to disable the interrupts while acquiring the lock.
The callback may be invoked either in IRQ or BH context depending on the
USB host controller.
Use the _irqsave() variant of the locking primitives.

Cc: Johan Hovold 
Cc: Greg Kroah-Hartman 
Signed-off-by: John Ogness 
Signed-off-by: Sebastian Andrzej Siewior 
---
 drivers/usb/serial/ti_usb_3410_5052.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/serial/ti_usb_3410_5052.c 
b/drivers/usb/serial/ti_usb_3410_5052.c
index 6b22857f6e52..3010878f7f8e 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -1215,6 +1215,7 @@ static void ti_bulk_in_callback(struct urb *urb)
struct usb_serial_port *port = tport->tp_port;
struct device *dev = &urb->dev->dev;
int status = urb->status;
+   unsigned long flags;
int retval = 0;
 
switch (status) {
@@ -1247,20 +1248,20 @@ static void ti_bulk_in_callback(struct urb *urb)
__func__);
else
ti_recv(port, urb->transfer_buffer, urb->actual_length);
-   spin_lock(&tport->tp_lock);
+   spin_lock_irqsave(&tport->tp_lock, flags);
port->icount.rx += urb->actual_length;
-   spin_unlock(&tport->tp_lock);
+   spin_unlock_irqrestore(&tport->tp_lock, flags);
}
 
 exit:
/* continue to read unless stopping */
-   spin_lock(&tport->tp_lock);
+   spin_lock_irqsave(&tport->tp_lock, flags);
if (tport->tp_read_urb_state == TI_READ_URB_RUNNING)
retval = usb_submit_urb(urb, GFP_ATOMIC);
else if (tport->tp_read_urb_state == TI_READ_URB_STOPPING)
tport->tp_read_urb_state = TI_READ_URB_STOPPED;
 
-   spin_unlock(&tport->tp_lock);
+   spin_unlock_irqrestore(&tport->tp_lock, flags);
if (retval)
dev_err(dev, "%s - resubmit read urb failed, %d\n",
__func__, retval);
-- 
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 06/12] usb: serial: mos7840: use irqsave() in USB's complete callback

2018-06-23 Thread Sebastian Andrzej Siewior
From: John Ogness 

The USB completion callback does not disable interrupts while acquiring
the lock. We want to remove the local_irq_disable() invocation from
__usb_hcd_giveback_urb() and therefore it is required for the callback
handler to disable the interrupts while acquiring the lock.
The callback may be invoked either in IRQ or BH context depending on the
USB host controller.
Use the _irqsave() variant of the locking primitives.

Cc: Johan Hovold 
Cc: Greg Kroah-Hartman 
Signed-off-by: John Ogness 
Signed-off-by: Sebastian Andrzej Siewior 
---
 drivers/usb/serial/mos7840.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index fdceb46d9fc6..4efffbbef5ae 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -802,18 +802,19 @@ static void mos7840_bulk_out_data_callback(struct urb 
*urb)
struct moschip_port *mos7840_port;
struct usb_serial_port *port;
int status = urb->status;
+   unsigned long flags;
int i;
 
mos7840_port = urb->context;
port = mos7840_port->port;
-   spin_lock(&mos7840_port->pool_lock);
+   spin_lock_irqsave(&mos7840_port->pool_lock, flags);
for (i = 0; i < NUM_URBS; i++) {
if (urb == mos7840_port->write_urb_pool[i]) {
mos7840_port->busy[i] = 0;
break;
}
}
-   spin_unlock(&mos7840_port->pool_lock);
+   spin_unlock_irqrestore(&mos7840_port->pool_lock, flags);
 
if (status) {
dev_dbg(&port->dev, "nonzero write bulk status received:%d\n", 
status);
-- 
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/12] usb: serial: symbolserial: use irqsave() in USB's complete callback

2018-06-23 Thread Sebastian Andrzej Siewior
From: John Ogness 

The USB completion callback does not disable interrupts while acquiring
the lock. We want to remove the local_irq_disable() invocation from
__usb_hcd_giveback_urb() and therefore it is required for the callback
handler to disable the interrupts while acquiring the lock.
The callback may be invoked either in IRQ or BH context depending on the
USB host controller.
Use the _irqsave() variant of the locking primitives.

Cc: Johan Hovold 
Cc: Greg Kroah-Hartman 
Signed-off-by: John Ogness 
Signed-off-by: Sebastian Andrzej Siewior 
---
 drivers/usb/serial/symbolserial.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/symbolserial.c 
b/drivers/usb/serial/symbolserial.c
index cd2f8dc8b58c..6ca24e86f686 100644
--- a/drivers/usb/serial/symbolserial.c
+++ b/drivers/usb/serial/symbolserial.c
@@ -35,6 +35,7 @@ static void symbol_int_callback(struct urb *urb)
struct symbol_private *priv = usb_get_serial_port_data(port);
unsigned char *data = urb->transfer_buffer;
int status = urb->status;
+   unsigned long flags;
int result;
int data_length;
 
@@ -73,7 +74,7 @@ static void symbol_int_callback(struct urb *urb)
}
 
 exit:
-   spin_lock(&priv->lock);
+   spin_lock_irqsave(&priv->lock, flags);
 
/* Continue trying to always read if we should */
if (!priv->throttled) {
@@ -84,7 +85,7 @@ static void symbol_int_callback(struct urb *urb)
__func__, result);
} else
priv->actually_throttled = true;
-   spin_unlock(&priv->lock);
+   spin_unlock_irqrestore(&priv->lock, flags);
 }
 
 static int symbol_open(struct tty_struct *tty, struct usb_serial_port *port)
-- 
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: UDC ep0 desc or no desc

2018-06-23 Thread Benjamin Herrenschmidt
On Sat, 2018-06-23 at 11:07 -0400, Alan Stern wrote:
> On Sat, 23 Jun 2018, Benjamin Herrenschmidt wrote:
> 
> > Hi folks !
> > 
> > I noticed some UDC drivers setup a "desc" pointer for ep0.desc for the
> > driver, some don't.
> > 
> > Is it officially needed ?
> 
> No, it isn't.  The only "core" routine that requires a desc pointer in 
> the endpoint structure is usb_ep_enable, and that routine explicitly 
> says it may not be called for ep0.
> 
> > Additionally some UCDs NULL out the desc pointer in ep_disable, is that
> > also a requirement ?
> 
> No.  A disabled endpoint doesn't have any requirements on its 
> descriptor or lack thereof.
> 
> > I somewhat fear that if somebody calls stuff like usb_ep_align() on ep0
> > it will crash without a valid desc pointer...
> 
> That would be a pretty strange thing to do.  I'd say it's not worth 
> worrying about until somebody makes that mistake.

Well, things like usb_endpoint_maxp() seem not *completely* far fetched
but yeah EP0 is usually special enough that it should be ok. That said,
I noticed some UDC drivers to setup a dummy desc there so I was
wondering ...

> > That leads me to wonder, should we sprinkle null checks (and maybe
> > WARN_ON_ONCE) on some of those accessors to catch those cases ?
> 
> I think segmentation faults will do a good job of catching them.  :-)

True, however in many practical cases, a WARN_ON and returning an error
(or a semi-sane value) will go a long way in helping debug things, for
example not crashing the machine and allowing a rmmod/insmod of a new
driver rather than a reboot :-) Also not all embedded systems have an
easily accessible serial console.

Anyway, I'll dig a bit more see if I can find what exactly is going on,
it's a report i have from somebody backporting to an old kernel so it
will require extra digging.

Cheers,
Ben.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html