Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp40604ybj; Fri, 8 May 2020 06:07:39 -0700 (PDT) X-Google-Smtp-Source: APiQypK6/aBypuLK8n43IEgYwUlfXXAC9ZCy6xvCnZU5SRuZEwTEqKY2dpLZwziDToMdlhbQwhwu X-Received: by 2002:a17:907:2155:: with SMTP id rk21mr1872180ejb.163.1588943259086; Fri, 08 May 2020 06:07:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588943259; cv=none; d=google.com; s=arc-20160816; b=Asz8FDN7PlYVEwvQevEd7l105uEVdOpNZqm2RqQS8dPIjl2c33094gcDZzcbtcBbbs k6f4P9ddQA1iIUMJz0qCTWCnTB4pmJsDC084Tbygndgifvcapx0QTZi4g1a8k0GgqKY+ XMqdlg/FCzhh8M86JbAtXq6IUN/FT5BKVzO1+WH+GYBnoTCkWxxsrL+YDQLPEazh9V1P I9QcZST5UGNsqv311P0b2xhnLIBuaNi1Cg8fA9PTtgzL+K6AL4YIv49NAtjPyPmTAasm C/uae8eSYJkIvksUNtSvBC+PnsQU09Uzmp5RdN0auJJipoQVAIu7RAGU/0cImqiukygu Yfpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=In/3pO0DAhgl6Jw1i6fHjIjX/PP8P0w5+QK9e7v5V1s=; b=pgYUBGMNnwbxwjrUhDyrP4H6+V7VooRNImEbzKSZFPoTgWBoM18sshq81zUULVttFT tCiw9klJ8IBFwjVLg8o5qX0DRFCe/G8k1o60SSRRKl4UwGPTtBD2hcS0NuGW1QUzesT2 Q2yPB3g2Amh0ekRomb6bnx8NdxkhXJf4BhlIJPYsQvkUU/TZ4Y8SjY+U/qoD6bXDij/N /dbAtkSXy4JdOqvUrj+i3VX4eRyLLmzUpPv1rxAait5rlJGIw6BOE7jzP1Mzsc6lBFPw MNKAdV9/h1vdyGwbXj0apPhEkzgTIYMAOmTNo7REe3xeHwxaBtMUhNMnFwzezqvhJKxp i6pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Rv+qV0YI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q6si838800edb.559.2020.05.08.06.07.14; Fri, 08 May 2020 06:07:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Rv+qV0YI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729813AbgEHMuF (ORCPT + 99 others); Fri, 8 May 2020 08:50:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:56772 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729802AbgEHMuB (ORCPT ); Fri, 8 May 2020 08:50:01 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3369424958; Fri, 8 May 2020 12:50:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588942200; bh=44MdXW0/tQSc7zi1YMwilVS4B9vWAuvAITdw+uxpS34=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rv+qV0YIdIkGYepJR8QZWINF90jg1fUqFNz5tnznvcggRzjlg99vN57DWXLRQaoB1 IE6mVb+jFJDLVmHRKU8jx+PgKrhJjrJqWTJX8RgPPUwTbaGDA2kUFWDWxJXMzl+hYe anwvqwudDQuOAk3x8DfBT32JBdGADMSACkWiY7jE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ronnie Sahlberg , Jeff Layton , Steve French , Sasha Levin Subject: [PATCH 4.9 08/18] cifs: protect updating server->dstaddr with a spinlock Date: Fri, 8 May 2020 14:35:11 +0200 Message-Id: <20200508123032.833331177@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200508123030.497793118@linuxfoundation.org> References: <20200508123030.497793118@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ronnie Sahlberg [ Upstream commit fada37f6f62995cc449b36ebba1220594bfe55fe ] We use a spinlock while we are reading and accessing the destination address for a server. We need to also use this spinlock to protect when we are modifying this address from reconn_set_ipaddr(). Signed-off-by: Ronnie Sahlberg Reviewed-by: Jeff Layton Signed-off-by: Steve French Signed-off-by: Sasha Levin --- fs/cifs/connect.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index f2707ff795d45..c018d161735c4 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -341,8 +341,10 @@ static int reconn_set_ipaddr(struct TCP_Server_Info *server) return rc; } + spin_lock(&cifs_tcp_ses_lock); rc = cifs_convert_address((struct sockaddr *)&server->dstaddr, ipaddr, strlen(ipaddr)); + spin_unlock(&cifs_tcp_ses_lock); kfree(ipaddr); return !rc ? -1 : 0; -- 2.20.1