Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2511138imm; Mon, 24 Sep 2018 05:42:20 -0700 (PDT) X-Google-Smtp-Source: ACcGV6032ab2B6eFMPI5J0VSJfEAqD73yxKff2RAqEilNV+27wnbp2bwm+51zdMRTOLKadX8soer X-Received: by 2002:a17:902:6909:: with SMTP id j9-v6mr10469924plk.196.1537792940165; Mon, 24 Sep 2018 05:42:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537792940; cv=none; d=google.com; s=arc-20160816; b=FRVFjszQRC+xQpmLrrd6k1s3vNgSWYhI1PigwYmBoPyhnOdlJOWom3QodY65v09e6m zSDobXbKeXeUtI/R5WG21hbvs3su8Xyude9hgfZdVK7+KT3PGUFhZpOuEsPEYSNu9wCc K4TN907XmpF4m+MQouIhpo/+cK1qK9gUeNA9FxQdAuCG3bzo0a9dEs6dZjbLnm51blfM OLms0jswvcXJUoaIsvVpy4/hZkUMIKoAQJszVMcVqVfoPXG7lI1gpZxGn7Rb47/o61/9 cJh/ggwLRFa82HfB4gex/Y4yZXmsjLTRkN8kJNjIc0N1RJG9B8CRmeKcW3YCShnw/ljT eINA== 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; bh=+bzNjx5RFynjmhuGWjxPNAGxqDuh4WFzP5RgZ/vOSOI=; b=Gi2J2Ph+65AS0S+nf9cUd6+WegT+HMUwWCBtvm3FHu+f7N/4rCF0Qc/29u0MU/uhRH xazksTYgA/W9iKs4gQI0M6RF7klBVzLq6I8A1dpbeNL59dCGeJ7uiTKd8fVFv/KywQio wIo0W84vuzyOY6Dz5PVuhoRwrtMRWgFxNg0fhxlNMN3RAWqFYopzIj03l34KgrIhPnl9 JBCYbObhBXkk+j2Ik3LXW40a9e7v3Gz4+FGLqVjRm2wqTg1UcKCJJ/j0GL5lUvUwgaDX GoxarDYgNXglRpC8T6BAH9tkOc5n8DOMMCjz+aHlKWeMLib+XD0KeFd0auAR3IjJT3sn UnWQ== ARC-Authentication-Results: i=1; mx.google.com; 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 w188-v6si37084317pfw.307.2018.09.24.05.42.04; Mon, 24 Sep 2018 05:42:20 -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; 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 S2388527AbeIXSlu (ORCPT + 99 others); Mon, 24 Sep 2018 14:41:50 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58894 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731070AbeIXSlt (ORCPT ); Mon, 24 Sep 2018 14:41:49 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id DE8471099; Mon, 24 Sep 2018 12:39:50 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Amir Goldstein , Miklos Szeredi , Christoph Hellwig , Sasha Levin Subject: [PATCH 4.18 151/235] vfs: fix freeze protection in mnt_want_write_file() for overlayfs Date: Mon, 24 Sep 2018 13:52:17 +0200 Message-Id: <20180924113120.475279668@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@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: Miklos Szeredi [ Upstream commit a6795a585929d94ca3e931bc8518f8deb8bbe627 ] The underlying real file used by overlayfs still contains the overlay path. This results in mnt_want_write_file() calls by the filesystem getting freeze protection on the wrong inode (the overlayfs one instead of the real one). Fix by using file_inode(file)->i_sb instead of file->f_path.mnt->mnt_sb. Reported-by: Amir Goldstein Signed-off-by: Miklos Szeredi Reviewed-by: Christoph Hellwig Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/namespace.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/fs/namespace.c +++ b/fs/namespace.c @@ -446,10 +446,10 @@ int mnt_want_write_file_path(struct file { int ret; - sb_start_write(file->f_path.mnt->mnt_sb); + sb_start_write(file_inode(file)->i_sb); ret = __mnt_want_write_file(file); if (ret) - sb_end_write(file->f_path.mnt->mnt_sb); + sb_end_write(file_inode(file)->i_sb); return ret; } @@ -540,7 +540,8 @@ void __mnt_drop_write_file(struct file * void mnt_drop_write_file_path(struct file *file) { - mnt_drop_write(file->f_path.mnt); + __mnt_drop_write_file(file); + sb_end_write(file_inode(file)->i_sb); } void mnt_drop_write_file(struct file *file)