From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752082AbbJJPE6 (ORCPT ); Sat, 10 Oct 2015 11:04:58 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:27649 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751417AbbJJPE4 (ORCPT ); Sat, 10 Oct 2015 11:04:56 -0400 Date: Sat, 10 Oct 2015 18:04:34 +0300 From: Dan Carpenter To: Alexey Khoroshilov Cc: Greg Kroah-Hartman , Larry Finger , devel@driverdev.osuosl.org, ldv-project@linuxtesting.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: r8188eu: Add _enter_critical_mutex() error handling Message-ID: <20151010140448.GW7340@mwanda> References: <1444430267-11421-1-git-send-email-khoroshilov@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1444430267-11421-1-git-send-email-khoroshilov@ispras.ru> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 10, 2015 at 01:37:47AM +0300, Alexey Khoroshilov wrote: > _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 > --- > drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 5 +++-- > drivers/staging/rtl8188eu/include/osdep_service.h | 9 --------- > drivers/staging/rtl8188eu/os_dep/os_intfs.c | 3 ++- > drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 5 ++++- > 4 files changed, 9 insertions(+), 13 deletions(-) > > diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c > index 935b48eef8b1..4e9312f0e902 100644 > --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c > +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c > @@ -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; This is reversed. mutex_lock_interruptible() returns -EINTR on failure. The rest of this patch is correct. regards, dan carpenter