Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp562216pxb; Thu, 19 Nov 2020 08:10:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJzcVSIxcfgy5T/KK0u425W68NCyyMhUP2BQW2c9qORqEa/IPPYOVWP2QmauF0dFwSts9Ji3 X-Received: by 2002:a17:906:8058:: with SMTP id x24mr29820572ejw.272.1605802254137; Thu, 19 Nov 2020 08:10:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605802254; cv=none; d=google.com; s=arc-20160816; b=KVM3CfgvnfQBpjRxB3G5O1i/hXY5Jn0upZ0F4eJiqCzZHkRrF2LfAyL2g/i9vH4nOW Jp70cLOvzwrEza6SGGMyQI5TH828Gqh9+hnaZnWBxW8+nIwO9ZK1zDlyWiHBDXF19SwE 4Z3OQFxq9FyNl1d19Jw02Afkhe+SpThRDV1Gh9uNPTyP/o0KJaii7PWslMaAbDKCfdtc CL+c0QjgqlhtMtdmLtfDmWmsVDyAUHFTKZRxc7z0rLf0TNjgeHvZkhGO7D4tHjAUlvFw EVxTjUWZjr4Zkg5OhkyiEpojVFbW62L/3pEWU3GDWvc7Jk+v50bGqV+l4Y/pLD9+tdHk A9NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:in-reply-to:message-id:date :subject:cc:from:dkim-signature; bh=eK6/Q/abk4MPm5E1E9fU+K69kfbIstGf/YUDyuJZEG0=; b=SblffWCryVoLi6MaOHIcKBEKdawlUZt9GLMEumk2mWjy8U9YxkvQBXNWrpJR8xJBpT sGOjul39yKIIk6usPdbZVb1kjOAEcUEByr4DpVZDpOeGbU2jCeplQaSBFNeHcTAIeT57 jNwDxUX9dIxVkrKI8jM0lnfHt1xrGDTyssZCzrSV6JfByz59xxtzf3POng6HVdc00bqz wRNzHrjPzobgL1visISLZKkbPz93ew4SUIB8ieKE1G/oIEaiNEfuY8p8HogUAuQISyqr 9TVCe89gEN/82lREI1+GtkVv+wodfA73WlcEQdmyRVg6DfgIWuSjlw4IQhK4aN9kVgGz zp5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@codewreck.org header.s=2 header.b=MqbGoote; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codewreck.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b8si106562ejp.173.2020.11.19.08.10.30; Thu, 19 Nov 2020 08:10:54 -0800 (PST) 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=fail header.i=@codewreck.org header.s=2 header.b=MqbGoote; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codewreck.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728506AbgKSQHY (ORCPT + 99 others); Thu, 19 Nov 2020 11:07:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728459AbgKSQHU (ORCPT ); Thu, 19 Nov 2020 11:07:20 -0500 Received: from nautica.notk.org (ipv6.notk.org [IPv6:2001:41d0:1:7a93::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2800DC0613CF for ; Thu, 19 Nov 2020 08:07:20 -0800 (PST) Received: by nautica.notk.org (Postfix, from userid 1001) id E42A7C01B; Thu, 19 Nov 2020 17:07:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1605802038; bh=eK6/Q/abk4MPm5E1E9fU+K69kfbIstGf/YUDyuJZEG0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MqbGoote7pDVzt+aCgVzGUEojP1xi9hk+JdvrMw6yr+451nTk80Nt+DnBs5e+IbC7 r8FIRiCE/TJOPXgv7OSuzIW5GvKyFDFQe18RJpSKPXVLCbRuOXcMlEbAj0SLwUTdfM BS9tsAXx5puT04bx0YSfIBWn7MSwuX5XHZTIdyHPxmYi3d1VWXGjkKasFj9K5t96ge /LmKup1BqrOjKs7iv5XCCy8YLXC3Exly515Y+FpJvUpBpaXxZIlVyVacicOad/e+Xi 7Lja1p76du44tIaL5wvbYX9N1aCaEJO/mDDRFm8mnrw3/hoOeKpD8TgEkAylAX5z5H muS8ALvu6vGUQ== From: Dominique Martinet Cc: Jianyong Wu , lucho@ionkov.net, justin.he@arm.com, ericvh@gmail.com, qemu_oss@crudebyte.com, groug@kaod.org, linux-kernel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, Dominique Martinet Subject: [PATCH 2/2] 9p: Fix writeback fid incorrectly being attached to dentry Date: Thu, 19 Nov 2020 17:06:52 +0100 Message-Id: <1605802012-31133-3-git-send-email-asmadeus@codewreck.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1605802012-31133-1-git-send-email-asmadeus@codewreck.org> References: <20201103104116.GA19587@nautica> <1605802012-31133-1-git-send-email-asmadeus@codewreck.org> To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org v9fs_dir_release needs fid->ilist to have been initialized for filp's fid, not the inode's writeback fid's. With refcounting this can be improved on later but this appears to fix null deref issues. Fixes: xxx ("fs/9p: track open fids") Signed-off-by: Dominique Martinet --- (note: fixes tag can't be filled here, will be corrected later) fs/9p/vfs_file.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index b0ef225cecd0..c5e49c88688d 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c @@ -46,7 +46,7 @@ int v9fs_file_open(struct inode *inode, struct file *file) int err; struct v9fs_inode *v9inode; struct v9fs_session_info *v9ses; - struct p9_fid *fid; + struct p9_fid *fid, *writeback_fid; int omode; p9_debug(P9_DEBUG_VFS, "inode: %p file: %p\n", inode, file); @@ -85,13 +85,13 @@ int v9fs_file_open(struct inode *inode, struct file *file) * because we want write after unlink usecase * to work. */ - fid = v9fs_writeback_fid(file_dentry(file)); + writeback_fid = v9fs_writeback_fid(file_dentry(file)); if (IS_ERR(fid)) { err = PTR_ERR(fid); mutex_unlock(&v9inode->v_mutex); goto out_error; } - v9inode->writeback_fid = (void *) fid; + v9inode->writeback_fid = (void *) writeback_fid; } mutex_unlock(&v9inode->v_mutex); if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) -- 2.28.0