From patchwork Tue Nov 16 00:27:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 12621317 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0571C433EF for ; Tue, 16 Nov 2021 03:51:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B91A561BFB for ; Tue, 16 Nov 2021 03:51:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235370AbhKPDyM (ORCPT ); Mon, 15 Nov 2021 22:54:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235337AbhKPDxo (ORCPT ); Mon, 15 Nov 2021 22:53:44 -0500 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D57D1C1A16DD for ; Mon, 15 Nov 2021 16:27:18 -0800 (PST) Received: by mail-lj1-x22f.google.com with SMTP id k2so31723321lji.4 for ; Mon, 15 Nov 2021 16:27:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to:cc; bh=oU68AkphVE+yjSX6PcL6AWriSdFHb9UDEuGlHNKpaf4=; b=TjJr6ok9l6tgJXT2h3TCF3nTeYVWEzZ0KAwpmCaSEYH5eEJ979pVJDcgbyE5IUNqDw J5F1ObNPnN2xE/eYuoL8kXDZce2hG78Zh4BFS/Rex2ePtyzoroI4yX7rngVmon/SofuK uB9aN36pJ7X/asdXQYCregGoIRRBRC7X+ynry0QRDQN6/RW8PKuT1qBA2woGzhWDZ8us b0jip1nnmmrTk+jX0RokB7bRJxFPGNeNLwkW//gO6G64Ra5HoSDEZjFZRfEUt1meq83v DCNRPFfEMqEgOmSljzg9jIINEStJ5Qg2okpEYWbbYtnoYo1WoWHXJn2A/awxCTVi2aNx sTZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=oU68AkphVE+yjSX6PcL6AWriSdFHb9UDEuGlHNKpaf4=; b=DEdFmDomz4smy/LLem1S3Zo0aGNNw9MhjZxiA0zHsdgqrF9NJ7/p9Er87UBjT53WT1 J/AGRtI6m4zdHOmqJX0DakMbOI06sEAGTVG54d5FddIr/xPGNEI0K14vrxiderNgcujt ykIew0Ice6loDkQoCNBh9XATJIfcVEPQR8K3YBUL1sEqMmUnAMFNbeLbhAmFEhj82itK 96H2yERLRvP2beLgQYhuMoC5N1KEdrOs9cTqQvpJoc5HUx8GVBNDPvvw/O4nzmr6ihsL gE/yXPgaRf8wax3owEqEbqYZ59/OCKdY/c5VZq8XCBLZJdej9sBmAepJBIwnK0KZSuHX 8I2w== X-Gm-Message-State: AOAM533FV6BbatSW4IlXNrEwxW64aYoOOC3mDvO6LJY3UhJHCKqRtP4R zPr9QCZ/xFVPQyGjGcrVaYegi6D4iQkDb5nCeSt1AyrC X-Google-Smtp-Source: ABdhPJwOVVtBdTlxlAyLdRSALD2wZUKLct3cSCtu6TTfQGGFkH8Sx/hb2dIhTxM1yVCZhE0aGrAVG9Q0l4IpFTgoFjU= X-Received: by 2002:a2e:2a46:: with SMTP id q67mr2774542ljq.398.1637022436976; Mon, 15 Nov 2021 16:27:16 -0800 (PST) MIME-Version: 1.0 From: Steve French Date: Mon, 15 Nov 2021 18:27:06 -0600 Message-ID: Subject: [PATCH] protect srv_count with cifs_tcp_ses_lock To: CIFS Cc: Shyam Prasad N Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org See attached patch that fixes a missing spinlock in multichannel patch series From 7a858b6a70320497bb24c493a79f252d7ab3b27c Mon Sep 17 00:00:00 2001 From: Steve French Date: Mon, 15 Nov 2021 18:02:27 -0600 Subject: [PATCH] cifs: protect srv_count with cifs_tcp_ses_lock Updates to the srv_count field are protected elsewhere with the cifs_tcp_ses_lock spinlock. Add one missing place (cifs_get_tcp_sesion). CC: Shyam Prasad N Signed-off-by: Steve French --- fs/cifs/connect.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 82577a7a5bb1..b98711b62897 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -1452,8 +1452,10 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx, tcp_ses->max_in_flight = 0; tcp_ses->credits = 1; if (primary_server) { + spin_lock(&cifs_tcp_ses_lock); ++primary_server->srv_count; tcp_ses->primary_server = primary_server; + spin_unlock(&cifs_tcp_ses_lock); } init_waitqueue_head(&tcp_ses->response_q); init_waitqueue_head(&tcp_ses->request_q); -- 2.32.0