Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751523AbbDZJPJ (ORCPT ); Sun, 26 Apr 2015 05:15:09 -0400 Received: from mail-bn1bon0147.outbound.protection.outlook.com ([157.56.111.147]:14802 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751411AbbDZJPD (ORCPT ); Sun, 26 Apr 2015 05:15:03 -0400 Authentication-Results: spf=none (sender IP is 165.204.84.221) smtp.mailfrom=amd.com; 8bytes.org; dkim=none (message not signed) header.d=none; X-WSS-ID: 0NNEPOX-07-VJF-02 X-M-MSG: Message-ID: <553CAC58.8000707@amd.com> Date: Sun, 26 Apr 2015 12:14:00 +0300 From: Oded Gabbay Organization: AMD User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: CC: , , Subject: Re: [PATCH] iommu/amd: Fix bug in put_pasid_state_wait References: <1429193324-20398-1-git-send-email-oded.gabbay@amd.com> In-Reply-To: <1429193324-20398-1-git-send-email-oded.gabbay@amd.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.20.0.84] X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.221;CTRY:US;IPV:NLI;EFV:NLI;BMV:1;SFV:NSPM;SFS:(10019020)(6009001)(428002)(189002)(164054003)(479174004)(199003)(51704005)(24454002)(377454003)(105586002)(2351001)(77156002)(4001350100001)(59896002)(87936001)(106466001)(62966003)(92566002)(101416001)(19580395003)(50986999)(19580405001)(80316001)(54356999)(46102003)(87266999)(50466002)(33656002)(110136001)(65816999)(36756003)(76176999)(47776003)(86362001)(2950100001)(77096005)(83506001)(65806001)(23746002)(3940600001);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR02MB193;H:atltwp01.amd.com;FPR:;SPF:None;MLV:sfv;MX:1;A:1;LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB193; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5002010)(5005006)(3002001);SRVR:BLUPR02MB193;BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB193; X-Forefront-PRVS: 0558D3C5AC X-OriginatorOrg: amd4.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2015 09:14:59.7433 (UTC) X-MS-Exchange-CrossTenant-Id: fde4dada-be84-483f-92cc-e026cbee8e96 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fde4dada-be84-483f-92cc-e026cbee8e96;Ip=[165.204.84.221];Helo=[atltwp01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR02MB193 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1395 Lines: 39 Hi Joerg, Could you please take a look at this patch ? I want it to be included in stable asap so Fedora 22 will pick it up. Thanks, Oded On 04/16/2015 05:08 PM, Oded Gabbay wrote: > This patch fixes a bug in put_pasid_state_wait that appeared in kernel 4.0 > The bug is that pasid_state->count wasn't decremented before entering the > wait_event. Thus, the condition in wait_event will never be true. > > The fix is to decrement (atomically) the pasid_state->count before the > wait_event. > > Signed-off-by: Oded Gabbay > Cc: stable@vger.kernel.org > --- > drivers/iommu/amd_iommu_v2.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c > index 6d5a5c4..173e70d 100644 > --- a/drivers/iommu/amd_iommu_v2.c > +++ b/drivers/iommu/amd_iommu_v2.c > @@ -266,6 +266,7 @@ static void put_pasid_state(struct pasid_state *pasid_state) > > static void put_pasid_state_wait(struct pasid_state *pasid_state) > { > + atomic_dec(&pasid_state->count); > wait_event(pasid_state->wq, !atomic_read(&pasid_state->count)); > free_pasid_state(pasid_state); > } > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/