Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S942059AbcJFJyg (ORCPT ); Thu, 6 Oct 2016 05:54:36 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47111 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755485AbcJFIgT (ORCPT ); Thu, 6 Oct 2016 04:36:19 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Assmann , Mustafa Ismail , Shiraz Saleem , Doug Ledford Subject: [PATCH 4.7 038/141] i40iw: Protect req_resource_num update Date: Thu, 6 Oct 2016 10:27:54 +0200 Message-Id: <20161006074450.297284695@linuxfoundation.org> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20161006074448.608056610@linuxfoundation.org> References: <20161006074448.608056610@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1114 Lines: 36 4.7-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mustafa Ismail commit 44856be3e95c87f03e850ef4fdf8c0503c2dde18 upstream. 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 Signed-off-by: Mustafa Ismail Signed-off-by: Shiraz Saleem Signed-off-by: Doug Ledford Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/i40iw/i40iw.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/infiniband/hw/i40iw/i40iw.h +++ b/drivers/infiniband/hw/i40iw/i40iw.h @@ -435,8 +435,8 @@ static inline int i40iw_alloc_resource(s *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; }