From patchwork Mon Feb 21 00:03:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niels Dossche X-Patchwork-Id: 12752913 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E88B3C433EF for ; Mon, 21 Feb 2022 00:04:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239014AbiBUAEe (ORCPT ); Sun, 20 Feb 2022 19:04:34 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:51604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229604AbiBUAEd (ORCPT ); Sun, 20 Feb 2022 19:04:33 -0500 Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20122.outbound.protection.outlook.com [40.107.2.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F28EA517DA; Sun, 20 Feb 2022 16:04:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IzhJ49Z/CVes5m2Jhq41LJ+OLloKfEJ2DI0yQcLvZDrGPVVkfy/a5+qnjSSHvOdssVkxNdqluiPmzzVWRGG6J5iHviR0v1QGmmRPE4KBRtO1TT0FZIBKvAUXOgeuA/qtuLx2Px0O+HBAST8136hdsVPyqQM104e5NLZ1UVi9pvugfGLEts9jE+ZXqIzZUuPEZD4Ug3jqD++VSXULWg0TmOO+X1Q6Hoq4usteaFB8e5gCUw7YQ59xmaprS3zpL9SqnhQYNV06rrOisGEN/6x/QA81fJn4ItBs8YKyJVTepwdV04KD3ViKkff9q7wSCfmSM3nrNxZOr13xnrf13xxelA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nTLIiB/y6mc1vxLwhlpAfK0LDuk+luyjUpB+t8x8Odc=; b=RyuQjEhJzDH315IiEcJrae9SdLF7NM7ebSToQ+c1+xnrZ5pNB151oZXT9iDtucM2eaHbnX2Tw0YfIH+DW9Vt8S80dRG3ZrgMvET9jnGSOs48FKq841vqeC/GhCts9cQimqGl4jyRuShsPpuQ5m9nHPfd8gZVMAYgNu8xOGL1q69ZjKHMyvCqikzvUDaKL/w3gU8BA4frIc2uBQDIjSdEBIVXLJMAc7UxBhqnUxPHciAiKtNwrUfUeWMjcB2mr4W89j841evCeMUwURbXP+iBXFNMA40mHUP/IUxRRntcaSMbd19r/AcIPB6bRsyhSGJla0khTIb0t8KEsbjZ/GLZPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ugent.be; dmarc=pass action=none header.from=ugent.be; dkim=pass header.d=ugent.be; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ugent.be; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nTLIiB/y6mc1vxLwhlpAfK0LDuk+luyjUpB+t8x8Odc=; b=eCe/qWOHq9UH9h/o0SHGVkiGRBwus4zJhDn2Fb7HAeB+u3O5cr9XEn9+nMnFnPqF3TRRvVmH/mD8o+QLHmqD2RS7AZNN8SNbPw3Q+VCB8i9wvTgoem805a7NXWGt+nzeI/5qWJrKxUhdoR0P9vzlawUlLmjqDU1b2i7wP+j98/I= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=ugent.be; Received: from AM6PR09MB2326.eurprd09.prod.outlook.com (2603:10a6:20b:46::12) by PR3PR09MB4395.eurprd09.prod.outlook.com (2603:10a6:102:39::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.16; Mon, 21 Feb 2022 00:04:07 +0000 Received: from AM6PR09MB2326.eurprd09.prod.outlook.com ([fe80::3538:ffcf:447d:9c2b]) by AM6PR09MB2326.eurprd09.prod.outlook.com ([fe80::3538:ffcf:447d:9c2b%4]) with mapi id 15.20.4995.027; Mon, 21 Feb 2022 00:04:06 +0000 Message-ID: <14d6e454-49c3-0a85-68f1-3f003ad032e6@ugent.be> Date: Mon, 21 Feb 2022 01:03:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: en-US To: Adaptec OEM Raid Solutions Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org From: Niels Dossche Subject: [PATCH] scsi: aacraid: add missing manage_lock on management_fib_count X-ClientProxiedBy: PR3P189CA0038.EURP189.PROD.OUTLOOK.COM (2603:10a6:102:53::13) To AM6PR09MB2326.eurprd09.prod.outlook.com (2603:10a6:20b:46::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6c2e2d67-ce6c-4e53-f325-08d9f4cda5d7 X-MS-TrafficTypeDiagnostic: PR3PR09MB4395:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fn+898kyyMoExPCid999Q5LD98Fe0TkZiv756vIaMS4RBQSbVPPib1XYt1twGqeIk/VshHx5LLDPTEuuhvLNrggVPOo4MdDcRLWbVaPaTrKBQbCNNDKqFy1ao2eSLjiNtvxc9WrIrBtdhPMifc9InfA6eGRQzHjUpCcdgxjZKaLef81gsTBDiPYFsWqhOALCnkzZOZwJS0mxw+5sE5NDa9tMGo5LZqEGNa1a4/PIsHvY0DVo8nMnBCJvKnRvRjWvQQZYPHLmLN1N2I/Xa5ufYghFNMF/PA+Mhy1uBfwSw/JuG25JwXMdUpcc21fdEL2naeJCl+h5MnkxJFbW1a37j4tHYkUs2AKwxysJsdBfgT9J0zRHP+Yzemk3PZctuE621d4741e1xzHTFcWVsaEVtQfOByTwXPY099WrAAcskBU/4tVm/I4AQyPxmMwMS4giGAj7DoU9LwSiXwJAppY87XW2vSArNv826s3D5i+HnQVdjBJUYjkjCMNUpsxFBxJHtcnSHKFRTNmlx2i16VT1glXzNaK/L3grUhpQpfV1+Kmg4fcJn1eq2X5c/5nNDkDP+Dsb1utlGvIIPzREGjFuGug8q86cae2TQ4bEmXh+B3nGvD3uuP/6PAtNvjC0UGMBplJAMX04dh5l8mOJGrKdGZ5eQjqXFwFDo4AWbaJfuvFC53nMddqMB4X4IlnZ3HS3naNFh4fGIp5kNv0ipIRMgI3JHdzo9H+bv/JFfNKHJgU= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR09MB2326.eurprd09.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(316002)(786003)(5660300002)(2616005)(86362001)(6916009)(83380400001)(36756003)(31696002)(186003)(31686004)(6486002)(6506007)(6512007)(6666004)(8676002)(66946007)(66556008)(66476007)(2906002)(44832011)(4744005)(508600001)(4326008)(38100700002)(8936002)(45980500001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?HS7dSvtWek2ejJbjpsmOvk8Aqnjx?= =?utf-8?q?7deIOY/tvQInl6pH45DzagRVuubTuuV8A9kVqm/hcBAfNaEofWsuDCJyzj+ZMoq/M?= =?utf-8?q?XwxGLs79UTleisgmq9En5mE66TJkTDwYRYP6VE5Kkb+IgixuTY2uEOoLgaN6dxjyI?= =?utf-8?q?chKLjzA3Hwgj/LPFB3XNuyYay3LtYnVVVEGRXxRr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ApuEhPf?= =?utf-8?q?nAhgSn5SudbSqb7ibGfJwMy0Lvf59NC3UiFuTwAVFT42DyQ63KIavDCT+Q7bzyCJJ?= =?utf-8?q?Aogm5ju7wqfa88GuRf+pQqk7clZbv2UkECU4Lf97wSviTJhZ+w89IWfqOstNxTmE+?= =?utf-8?q?NyhS4971cwObqEGG3tFKffVI1RvzQTfHmM/TWSFQUr2J8Sjq2eW5CYAo5yIC/jMD/?= =?utf-8?q?XkRBJ7J8mat4ogSRumkShMuXEzoHLpVgOWblvYY6NP9R3YmqWwpuba6e+PHMue0WS?= =?utf-8?q?3HvnUZaIaylAIvECGdXmIwZtVMvc+KZQEnfO9BZPWXrs8KS8kXVzfZ+P5zrp2GNVP?= =?utf-8?q?SiEUZ7IQsEiDafWbaLP+YcwmI0L2rMa6InvlVudULUpUaNoC3orz6NZ7YXjr//LdP?= =?utf-8?q?fEWLi5fFLBivg1E7LN+CqgrbuGglHwBdHqDGj7V5CIO8muioUefDY1phMwrTUQ3Jq?= =?utf-8?q?FgA1zGtQWhm5HP51dEVGj/1IfOZBMVBKKdeWOqsXSxTLPT3eZWUsYl6GhnVucRjAH?= =?utf-8?q?MdgdVneNSSDCQeHne9QB8dodRPWlmbv2TaXGVGBmymAk2wBDwXadek=3D?= X-OriginatorOrg: ugent.be X-MS-Exchange-CrossTenant-Network-Message-Id: 6c2e2d67-ce6c-4e53-f325-08d9f4cda5d7 X-MS-Exchange-CrossTenant-AuthSource: AM6PR09MB2326.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2022 00:04:06.9368 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d7811cde-ecef-496c-8f91-a1786241b99c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JykuW15WwK7a10aGjm+otXNIfhIXpp7KDifOnrAGb7Gg6OhBsWH82/t9IDgm7ejFZIa8lL80GnskgmW/UozAkw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR09MB4395 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org All other places modify the management_fib_count under the manage_lock. Avoid a possible race condition by also applying that lock in aac_src_intr_message. Signed-off-by: Niels Dossche --- drivers/scsi/aacraid/src.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c index 11ef58204e96..ca73439587ed 100644 --- a/drivers/scsi/aacraid/src.c +++ b/drivers/scsi/aacraid/src.c @@ -91,7 +91,9 @@ static irqreturn_t aac_src_intr_message(int irq, void *dev_id) dev->sync_fib); spin_lock_irqsave(&dev->sync_fib->event_lock, sflags); if (dev->sync_fib->flags & FIB_CONTEXT_FLAG_WAIT) { + spin_lock(&dev->manage_lock); dev->management_fib_count--; + spin_unlock(&dev->manage_lock); complete(&dev->sync_fib->event_wait); } spin_unlock_irqrestore(&dev->sync_fib->event_lock,