From ac0a36679928e3e8d7cc0b4c2fd02fb368186992 Mon Sep 17 00:00:00 2001 From: Alexey Khoroshilov Date: Sun, 18 Oct 2015 00:33:09 +0300 Subject: 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 Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/os_intfs.c | 3 ++- drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'drivers/staging/rtl8188eu/os_dep') diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c b/drivers/staging/rtl8188eu/os_dep/os_intfs.c index d85647c..d063d02 100644 --- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c +++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c @@ -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; diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c index 7e599bc..0fea338 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c @@ -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; -- cgit v1.1