]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
i40iw: Protect req_resource_num update
authorMustafa Ismail <mustafa.ismail@intel.com>
Mon, 22 Aug 2016 23:15:58 +0000 (18:15 -0500)
committerDoug Ledford <dledford@redhat.com>
Tue, 23 Aug 2016 16:40:20 +0000 (12:40 -0400)
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>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/i40iw/i40iw.h

index 882f3ef2e4c7ac349375eab5701cb20ae6712ff7..8ec09e470f848334e746b50326c6eadcf57785cd 100644 (file)
@@ -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;
 }