diff mbox

i40iw: Protect req_resource_num update

Message ID 1471907758-80028-1-git-send-email-shiraz.saleem@intel.com (mailing list archive)
State Accepted
Headers show

Commit Message

Saleem, Shiraz Aug. 22, 2016, 11:15 p.m. UTC
From: Mustafa Ismail <mustafa.ismail@intel.com> 

In i40iw_alloc_resource(), ensure that the update to
req_resource_num is protected by the lock.

Fixes: 8e06af711bf2 ("i40iw: add main, hdr, status")

Reported-by: Stefan Assmann <sassmann@redhat.com>
Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
---
 drivers/infiniband/hw/i40iw/i40iw.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Doug Ledford Aug. 23, 2016, 4:45 p.m. UTC | #1
On 8/22/2016 7:15 PM, Shiraz Saleem wrote:
> From: Mustafa Ismail <mustafa.ismail@intel.com> 
> 
> In i40iw_alloc_resource(), ensure that the update to
> req_resource_num is protected by the lock.
> 
> Fixes: 8e06af711bf2 ("i40iw: add main, hdr, status")
> 
> Reported-by: Stefan Assmann <sassmann@redhat.com>
> Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>
> Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>

Applied, thanks.
diff mbox

Patch

diff --git a/drivers/infiniband/hw/i40iw/i40iw.h b/drivers/infiniband/hw/i40iw/i40iw.h
index 882f3ef..8ec09e4 100644
--- a/drivers/infiniband/hw/i40iw/i40iw.h
+++ b/drivers/infiniband/hw/i40iw/i40iw.h
@@ -435,8 +435,8 @@  static inline int i40iw_alloc_resource(struct i40iw_device *iwdev,
 	*next = resource_num + 1;
 	if (*next == max_resources)
 		*next = 0;
-	spin_unlock_irqrestore(&iwdev->resource_lock, flags);
 	*req_resource_num = resource_num;
+	spin_unlock_irqrestore(&iwdev->resource_lock, flags);
 
 	return 0;
 }