BZ: 31586
The n_gsm code doesn't have protection to avoid to perform
a write if a DLCi is not in the DLCI_OPEN state. This means
that it's possible to have data sending to the modem when
the DLCi is in the DLCI_OPENING state. Means, when the DLCi
is performing the asynchronous open.
To avoid this, this patch fix the write operation to return
the EAGAIN error if the write is not allowed.
Signed-off-by: Guillaume Lucas <guillaume.lucas@intel.com>
Change-Id: I3a98a9960e62a82afe96b1694a0a67727d84f5bb
Reviewed-on: http://android.intel.com:8080/43298
Reviewed-by: Lucas, Guillaume <guillaume.lucas@intel.com>
Reviewed-by: Pillet, VincentX <vincentx.pillet@intel.com>
Reviewed-by: Roulliere, Pierre <pierre.roulliere@intel.com>
Reviewed-by: Robert, Denis <denis.robert@intel.com>
Reviewed-by: Predon, Frederic <frederic.predon@intel.com>
Reviewed-by: Lebsir, SamiX <samix.lebsir@intel.com>
Tested-by: Lebsir, SamiX <samix.lebsir@intel.com>
Tested-by: buildbot <buildbot@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
int len)
{
struct gsm_dlci *dlci = tty->driver_data;
+ int sent;
+
+ if (dlci->state != DLCI_OPEN)
+ return -EAGAIN;
+
/* Stuff the bytes into the fifo queue */
- int sent = kfifo_in_locked(dlci->fifo, buf, len, &dlci->lock);
+ sent = kfifo_in_locked(dlci->fifo, buf, len, &dlci->lock);
/* Need to kick the channel */
gsm_dlci_data_kick(dlci);
return sent;