staging: r8188eu: Add _enter_critical_mutex() error handling

_enter_critical_mutex() is a simple call to mutex_lock_interruptible(),
but there is no error handling code for it.

The patch removes wrapper _enter_critical_mutex() and
adds error handling for mutex_lock_interruptible().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Alexey Khoroshilov 2015-10-18 00:33:09 +03:00 committed by Greg Kroah-Hartman
parent d566e69024
commit ac0a366799
4 changed files with 9 additions and 13 deletions

View File

@ -271,7 +271,8 @@ static s32 dump_mgntframe_and_wait_ack(struct adapter *padapter,
if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
return -1;
_enter_critical_mutex(&pxmitpriv->ack_tx_mutex, NULL);
if (mutex_lock_interruptible(&pxmitpriv->ack_tx_mutex))
return _FAIL;
pxmitpriv->ack_tx = true;
pmgntframe->ack_report = 1;
@ -282,7 +283,7 @@ static s32 dump_mgntframe_and_wait_ack(struct adapter *padapter,
pxmitpriv->ack_tx = false;
mutex_unlock(&pxmitpriv->ack_tx_mutex);
return ret;
return ret;
}
static int update_hidden_ssid(u8 *ies, u32 ies_len, u8 hidden_ssid_mode)

View File

@ -67,15 +67,6 @@ static inline struct list_head *get_list_head(struct __queue *queue)
return &(queue->queue);
}
static inline int _enter_critical_mutex(struct mutex *pmutex,
unsigned long *pirqL)
{
int ret;
ret = mutex_lock_interruptible(pmutex);
return ret;
}
static inline int rtw_netif_queue_stopped(struct net_device *pnetdev)
{
return netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 0)) &&

View File

@ -1058,7 +1058,8 @@ static int netdev_open(struct net_device *pnetdev)
int ret;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev);
_enter_critical_mutex(&padapter->hw_init_mutex, NULL);
if (mutex_lock_interruptible(&padapter->hw_init_mutex))
return -ERESTARTSYS;
ret = _netdev_open(pnetdev);
mutex_unlock(&padapter->hw_init_mutex);
return ret;

View File

@ -249,7 +249,10 @@ static int usbctrl_vendorreq(struct adapter *adapt, u8 request, u16 value, u16 i
goto exit;
}
_enter_critical_mutex(&dvobjpriv->usb_vendor_req_mutex, NULL);
if (mutex_lock_interruptible(&dvobjpriv->usb_vendor_req_mutex)) {
status = -ERESTARTSYS;
goto exit;
}
/* Acquire IO memory for vendorreq */
pIo_buf = dvobjpriv->usb_vendor_req_buf;