Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3932204imm; Mon, 8 Oct 2018 11:54:33 -0700 (PDT) X-Google-Smtp-Source: ACcGV629Vu+gJLyBMiRcg8jelVYTR2KiGZpVHKp6PJB2eFH2u/kLRWx52fI4QjABqjZHmtQZ3e08 X-Received: by 2002:a63:5224:: with SMTP id g36-v6mr22620758pgb.253.1539024873700; Mon, 08 Oct 2018 11:54:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539024873; cv=none; d=google.com; s=arc-20160816; b=rDG1inBbQM8jxCpgtjRpGcMBzJeU82fQGAxTaX0UuNq7NpkG3MruJcJx7LlfJmpvpA YlJylpvUrBqP+16+rG2MTb/BGA6uzZFY06C8ba1Zt9sL8cFO9H6ISHB0rejRK+mx6rnP ajtVf3FSHUtQ3EE9OG+ah87Z51cKo5S5xBei5wLuRycuj7xnv7D6wn3KKEjFY/GoylOD jw7ms5I+V5naVpBpRu4AqmxYQfptiDgHhXn8/23szuRqtVcehRLWWb0Gpqef22xK6v1N goT6qH0Zt9mbxph5JO1PNC3y16xm+cE7ltZ+u50TsgjtPKnmAEp3TT7Y1hv0GKvKtwsv BcqQ== 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=KvNTFHpdufGHx3frIYKB1KBO8aTL6hQ/OGxG3DHAOzA=; b=aWdJSOJ15tc3GOm2+xtC7IfTvyQxv6xWpZVso6sJTjiiLDDOOdm9oXx0ZWJpnamYFF MES1WiuDDTrJFsgZtNA5CyPEk1mP6yCpIDIBCDbYS6Ja981Kd87tQs2p/+PozNQm/1FT Rtb6bRo/m+Yc2kpqAd+gi4/SXOmwpVAJt7/daUbkFSJYn1RB54q2m6/VZkzPvIXLqCMm QX6AI3gqsW80EQW+0Od6fnhcU8sDAb1vhBW4ACNS+glk7eXaxVzzsvPH7/1sNtQ6J/r+ xQ63C36SxMEZu6R35x92idPR9wyZtlhy3QamrDv9ep+dJpONE6M8xJujGC/yzOQZ0ziy BtUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eeJXm8U0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w18-v6si19021538plq.104.2018.10.08.11.54.18; Mon, 08 Oct 2018 11:54:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eeJXm8U0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732891AbeJICHS (ORCPT + 99 others); Mon, 8 Oct 2018 22:07:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:57830 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeJICHR (ORCPT ); Mon, 8 Oct 2018 22:07:17 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (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 D600021479; Mon, 8 Oct 2018 18:54:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539024848; bh=Qh8rXzrzSbcolP48fujx/nLatDMSPWgPjBmXTf+h0NM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eeJXm8U0QA4CXsDzOEiFXh1ipQANediD5Ue+IojuJE/yOm3RujdXLuvd0oGNYGasG Jv4zdTChXlDLSInMmVUz8YuB5N9GKniN+Qo+2XyZhbDQf7Nochnarjz0rixtMBqkY+ 4A3QWmozcazJwmh1qDytxd177fWFx8o6NnWCYnfY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ashish Samant , Changwei Ge , Joseph Qi , Jun Piao , Mark Fasheh , Joel Becker , Junxiao Bi , Andrew Morton Subject: [PATCH 4.18 166/168] ocfs2: fix locking for res->tracking and dlm->tracking_list Date: Mon, 8 Oct 2018 20:32:26 +0200 Message-Id: <20181008175626.366582279@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175620.043587728@linuxfoundation.org> References: <20181008175620.043587728@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ashish Samant commit cbe355f57c8074bc4f452e5b6e35509044c6fa23 upstream. In dlm_init_lockres() we access and modify res->tracking and dlm->tracking_list without holding dlm->track_lock. This can cause list corruptions and can end up in kernel panic. Fix this by locking res->tracking and dlm->tracking_list with dlm->track_lock instead of dlm->spinlock. Link: http://lkml.kernel.org/r/1529951192-4686-1-git-send-email-ashish.samant@oracle.com Signed-off-by: Ashish Samant Reviewed-by: Changwei Ge Acked-by: Joseph Qi Acked-by: Jun Piao Cc: Mark Fasheh Cc: Joel Becker Cc: Junxiao Bi Cc: Changwei Ge Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- fs/ocfs2/dlm/dlmmaster.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c @@ -584,9 +584,9 @@ static void dlm_init_lockres(struct dlm_ res->last_used = 0; - spin_lock(&dlm->spinlock); + spin_lock(&dlm->track_lock); list_add_tail(&res->tracking, &dlm->tracking_list); - spin_unlock(&dlm->spinlock); + spin_unlock(&dlm->track_lock); memset(res->lvb, 0, DLM_LVB_LEN); memset(res->refmap, 0, sizeof(res->refmap));