From patchwork Thu Mar 13 04:28:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 14014288 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B48ED78F37 for ; Thu, 13 Mar 2025 04:28:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741840100; cv=none; b=dfUckBBi/UiY6Zyz8TUj61IENnvfc1K3wRClgAcbAdu8xj5S/PtS2gjnPCqgzHext3YbooTlvmwalcuCgScHnuUFj0DvA2Cz8ICx9iffwwtigd9vybz1hHQGdV2hz2Dq48DD2EbzQj/pV9F6l20rzlspgcwU7yyfJI6ptq6dCLA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741840100; c=relaxed/simple; bh=GhjSUtfxoH0sMGxYX1SmTttv++we8SpGyOxtQzhsW9c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VIn7rXx9OY3/yLqxFKc3L0BEY0VOjd/XOqTQ+Paytj7RuHdQsIOSp9us7vb0n3UGwWvH2DxHHVX0mhE9FoXyUE0ARnsx3M4FjpdR2LCNAcGyWHZQhmHLnsIK4NfMyQVtUTT4tzzIBwCTq64kJbQ/EVVv8D0GkTSGxL/IZcPNM60= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=pBTHsjpL; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="pBTHsjpL" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=0BP8MfTLuj9N3cb4tR84hglIRqD5ctl8ZjP83WvUF9U=; b=pBTHsjpL1jvToEEn5hmZzajt2u umPZBo0JNyohTPH51UgCJPPsfaaWlChpDgzaqSzdA67dH/ZAk7ZQmPq68EqzBK0fELPHJ6CK8+fu2 1PNa6nCDCQHY3m3P36WrpcozAV2eWK0co7zHe+IHr+U0QfJzaHkKcoeGcmoqQKIAi30sjHVUt5kYY Iogo0vEVNfmhoLNCt+rGrtVr8l4LAf4OOvmhPTPKjb/KaKNgsYXkKWfcQK3k7QZ/IW7IYsSSWaefD /5+UE+JcU7hiNO/j7Lym29TYRu+qNYMZe16CoQYLMzfo8pBwRE5Dowd1Zw879/uHMKdEy32g5TGhh C6n+TzBw==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98.1 #2 (Red Hat Linux)) id 1tsaB5-00000008udD-2yth; Thu, 13 Mar 2025 04:28:15 +0000 Date: Thu, 13 Mar 2025 04:28:15 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 1/4] spufs: fix a leak on spufs_new_file() failure Message-ID: <20250313042815.GA2123707@ZenIV> References: <20250313042702.GU2023217@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20250313042702.GU2023217@ZenIV> Sender: Al Viro It's called from spufs_fill_dir(), and caller of that will do spufs_rmdir() in case of failure. That does remove everything we'd managed to create, but... the problem dentry is still negative. IOW, it needs to be explicitly dropped. Fixes: 3f51dd91c807 "[PATCH] spufs: fix spufs_fill_dir error path" Signed-off-by: Al Viro Reviewed-by: Christian Brauner --- arch/powerpc/platforms/cell/spufs/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c index 70236d1df3d3..793c005607cf 100644 --- a/arch/powerpc/platforms/cell/spufs/inode.c +++ b/arch/powerpc/platforms/cell/spufs/inode.c @@ -192,8 +192,10 @@ static int spufs_fill_dir(struct dentry *dir, return -ENOMEM; ret = spufs_new_file(dir->d_sb, dentry, files->ops, files->mode & mode, files->size, ctx); - if (ret) + if (ret) { + dput(dentry); return ret; + } files++; } return 0; From patchwork Thu Mar 13 04:29:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 14014289 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2DD7E143759 for ; Thu, 13 Mar 2025 04:29:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741840145; cv=none; b=eUC/ZTxXusf1xXvLPfOan0ZspOk9KEf+kScf6OPJesvkPrNAjRRhVhE7EIIexf/lV26eNfQ8GJ7F/Wg5YuQnITYB4dDApNWKsuB+/oS1N3iIm9JgxufVhefgfSFoxRFW+25VomWfKUV6WCe1LkQePUzVUCTwYuxXxaJoHx+Hi6k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741840145; c=relaxed/simple; bh=s4Ne1SQuzy4aH+hXvZtgFE1K22RbtmJIBvOd9mk9cKw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=F+RU+xB8+YEt5g1emfRbLGT0DOmlEE24RurLY+aClF7cDY+mQ8AKIDAzMT9Peo8ecDOkguRG5XK0qsJJMIGUJvQ2dWAwlQuDbebpiE0X8a7ikOCPMrSsu5JJ982Cqf0JQYXwbnuuGUvHHl/FZfxW71X69cN4+UDd4ZYVDEL8q/w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=OpEqKn15; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="OpEqKn15" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=14tDRv0m3KWa5MO98XzRjgrnHoCrERApPyOZJnilAvc=; b=OpEqKn15W/Vx5xvvt077WIsUM4 VxUGByHQ4DkkcVcLK/im9XISUt30u1mYZDHPAzf7iISvcX8GD4IZqZrqHPy1Rl5n8asGDZC8FAgZK cMtxpLK/mepEmOWmR3Kg9tEuEE9vNlEICfkgoWyvT2I/YoDWQK2DZodP0sNLtMQxdsJB7+axvPaWx +lL+SW735ltvmsr8yP468U2BU8RYaeiqo5+YrUvenicbhpervfmgAzM7ayaC6ZzX00niktP98Slu4 5UMMc0EgAeyPZIVvUuMUgMcuftT0ColGvG8dSP8T3OkR+kVpusyBGIj5ZJr1aRUvmPd7K90ibsYKy rvAKIZEQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98.1 #2 (Red Hat Linux)) id 1tsaBp-00000008ukM-2DSa; Thu, 13 Mar 2025 04:29:01 +0000 Date: Thu, 13 Mar 2025 04:29:01 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 2/4] spufs: fix gang directory lifetimes Message-ID: <20250313042901.GB2123707@ZenIV> References: <20250313042702.GU2023217@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20250313042702.GU2023217@ZenIV> Sender: Al Viro prior to "[POWERPC] spufs: Fix gang destroy leaks" we used to have a problem with gang lifetimes - creation of a gang returns opened gang directory, which normally gets removed when that gets closed, but if somebody has created a context belonging to that gang and kept it alive until the gang got closed, removal failed and we ended up with a leak. Unfortunately, it had been fixed the wrong way. Dentry of gang directory was no longer pinned, and rmdir on close was gone. One problem was that failure of open kept calling simple_rmdir() as cleanup, which meant an unbalanced dput(). Another bug was in the success case - gang creation incremented link count on root directory, but that was no longer undone when gang got destroyed. Fix consists of * reverting the commit in question * adding a counter to gang, protected by ->i_rwsem of gang directory inode. * having it set to 1 at creation time, dropped in both spufs_dir_close() and spufs_gang_close() and bumped in spufs_create_context(), provided that it's not 0. * using simple_recursive_removal() to take the gang directory out when counter reaches zero. Fixes: 877907d37da9 "[POWERPC] spufs: Fix gang destroy leaks" Signed-off-by: Al Viro Reviewed-by: Christian Brauner --- arch/powerpc/platforms/cell/spufs/gang.c | 1 + arch/powerpc/platforms/cell/spufs/inode.c | 54 +++++++++++++++++++---- arch/powerpc/platforms/cell/spufs/spufs.h | 2 + 3 files changed, 49 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/platforms/cell/spufs/gang.c b/arch/powerpc/platforms/cell/spufs/gang.c index 827d338deaf4..2c2999de6bfa 100644 --- a/arch/powerpc/platforms/cell/spufs/gang.c +++ b/arch/powerpc/platforms/cell/spufs/gang.c @@ -25,6 +25,7 @@ struct spu_gang *alloc_spu_gang(void) mutex_init(&gang->aff_mutex); INIT_LIST_HEAD(&gang->list); INIT_LIST_HEAD(&gang->aff_list_head); + gang->alive = 1; out: return gang; diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c index 793c005607cf..c566e7997f2c 100644 --- a/arch/powerpc/platforms/cell/spufs/inode.c +++ b/arch/powerpc/platforms/cell/spufs/inode.c @@ -201,6 +201,23 @@ static int spufs_fill_dir(struct dentry *dir, return 0; } +static void unuse_gang(struct dentry *dir) +{ + struct inode *inode = dir->d_inode; + struct spu_gang *gang = SPUFS_I(inode)->i_gang; + + if (gang) { + bool dead; + + inode_lock(inode); // exclusion with spufs_create_context() + dead = !--gang->alive; + inode_unlock(inode); + + if (dead) + simple_recursive_removal(dir, NULL); + } +} + static int spufs_dir_close(struct inode *inode, struct file *file) { struct inode *parent; @@ -215,6 +232,7 @@ static int spufs_dir_close(struct inode *inode, struct file *file) inode_unlock(parent); WARN_ON(ret); + unuse_gang(dir->d_parent); return dcache_dir_close(inode, file); } @@ -407,7 +425,7 @@ spufs_create_context(struct inode *inode, struct dentry *dentry, { int ret; int affinity; - struct spu_gang *gang; + struct spu_gang *gang = SPUFS_I(inode)->i_gang; struct spu_context *neighbor; struct path path = {.mnt = mnt, .dentry = dentry}; @@ -422,11 +440,15 @@ spufs_create_context(struct inode *inode, struct dentry *dentry, if ((flags & SPU_CREATE_ISOLATE) && !isolated_loader) return -ENODEV; - gang = NULL; + if (gang) { + if (!gang->alive) + return -ENOENT; + gang->alive++; + } + neighbor = NULL; affinity = flags & (SPU_CREATE_AFFINITY_MEM | SPU_CREATE_AFFINITY_SPU); if (affinity) { - gang = SPUFS_I(inode)->i_gang; if (!gang) return -EINVAL; mutex_lock(&gang->aff_mutex); @@ -455,6 +477,8 @@ spufs_create_context(struct inode *inode, struct dentry *dentry, out_aff_unlock: if (affinity) mutex_unlock(&gang->aff_mutex); + if (ret && gang) + gang->alive--; // can't reach 0 return ret; } @@ -484,6 +508,7 @@ spufs_mkgang(struct inode *dir, struct dentry *dentry, umode_t mode) inode->i_fop = &simple_dir_operations; d_instantiate(dentry, inode); + dget(dentry); inc_nlink(dir); inc_nlink(d_inode(dentry)); return ret; @@ -494,6 +519,21 @@ spufs_mkgang(struct inode *dir, struct dentry *dentry, umode_t mode) return ret; } +static int spufs_gang_close(struct inode *inode, struct file *file) +{ + unuse_gang(file->f_path.dentry); + return dcache_dir_close(inode, file); +} + +static const struct file_operations spufs_gang_fops = { + .open = dcache_dir_open, + .release = spufs_gang_close, + .llseek = dcache_dir_lseek, + .read = generic_read_dir, + .iterate_shared = dcache_readdir, + .fsync = noop_fsync, +}; + static int spufs_gang_open(const struct path *path) { int ret; @@ -513,7 +553,7 @@ static int spufs_gang_open(const struct path *path) return PTR_ERR(filp); } - filp->f_op = &simple_dir_operations; + filp->f_op = &spufs_gang_fops; fd_install(ret, filp); return ret; } @@ -528,10 +568,8 @@ static int spufs_create_gang(struct inode *inode, ret = spufs_mkgang(inode, dentry, mode & 0777); if (!ret) { ret = spufs_gang_open(&path); - if (ret < 0) { - int err = simple_rmdir(inode, dentry); - WARN_ON(err); - } + if (ret < 0) + unuse_gang(dentry); } return ret; } diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h index 84958487f696..d33787c57c39 100644 --- a/arch/powerpc/platforms/cell/spufs/spufs.h +++ b/arch/powerpc/platforms/cell/spufs/spufs.h @@ -151,6 +151,8 @@ struct spu_gang { int aff_flags; struct spu *aff_ref_spu; atomic_t aff_sched_count; + + int alive; }; /* Flag bits for spu_gang aff_flags */ From patchwork Thu Mar 13 04:29:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 14014290 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4762A142E6F for ; Thu, 13 Mar 2025 04:29:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741840175; cv=none; b=Wia1km0g7imxmXpP+nD+VAP5yR0xWMbSYHrvu5mYlpunhWM4WKnrnrau0GF1yLet/SiTItwnwBxENtHwO7Ru4/1XcqACC9+WgCh1zHqDPZYiMjE/vwVKkZ/eKdue50EEZKtD73JVQwnEURtrKFWPnKSfx12sd5fDT7y7ntSvess= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741840175; c=relaxed/simple; bh=Xg8T94qtVgcjSHuagINa4IMdgoNsud//IQbvINSO5OY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RNvCDS6OEcBAHLQtJg9gP0XJ+9+BlyXkIHlx/1NaNYgGvYWV2V4J2mY7IP/W/t5BCB/cKiWDq5JlE9N/uzu9r/gZo+kjmJuN0ydRY9JVFjAmUeCA0J3tP6GvBWtpxZ9dIbdMxSR0daTvHdtLCofZaGISl3R7y/+FxTEk0j+ZkXM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=r66vlrB3; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="r66vlrB3" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=r3XimgkWh+v3Pk6WwqVJOIdff7gbdmDD9MXU+Y8RHIs=; b=r66vlrB3EhAsHruV5Zd43iQCcZ MqLOiTBQvehkbnlCsfWJ5O80Y+lHqwklIM5oSDOIualrvlmxEdvpMe4WHwQfbk6jk3t1tkqlQKnFC Neqjp6kEvHVCBkeRkfwJDGIe60gs81mUFxGMiLL5IgS3Bni5+vHEqffJs9gSbIfiMQP4HoGWlzUNg UBtWl+4le960Fnory0ZqWz0bprxxfG0+bF2digYEXVaXgYqM0I/gdcBeHWuixivzc0LdXnYrerGTc 2hccnJHRj8dpJZFNeiRtLhZ4SV8l5YNkYzuaoQhHvxkCDg3nw3sMzS11F+9jOZlHHWnHsAHJpWR8/ SvRQoCwg==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98.1 #2 (Red Hat Linux)) id 1tsaCK-00000008uor-2Ufy; Thu, 13 Mar 2025 04:29:32 +0000 Date: Thu, 13 Mar 2025 04:29:32 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 3/4] spufs: fix a leak in spufs_create_context() Message-ID: <20250313042932.GC2123707@ZenIV> References: <20250313042702.GU2023217@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20250313042702.GU2023217@ZenIV> Sender: Al Viro Leak fixes back in 2008 missed one case - if we are trying to set affinity and spufs_mkdir() fails, we need to drop the reference to neighbor. Fixes: 58119068cb27 "[POWERPC] spufs: Fix memory leak on SPU affinity" Signed-off-by: Al Viro Reviewed-by: Christian Brauner --- arch/powerpc/platforms/cell/spufs/inode.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c index c566e7997f2c..9f9e4b871627 100644 --- a/arch/powerpc/platforms/cell/spufs/inode.c +++ b/arch/powerpc/platforms/cell/spufs/inode.c @@ -460,8 +460,11 @@ spufs_create_context(struct inode *inode, struct dentry *dentry, } ret = spufs_mkdir(inode, dentry, flags, mode & 0777); - if (ret) + if (ret) { + if (neighbor) + put_spu_context(neighbor); goto out_aff_unlock; + } if (affinity) { spufs_set_affinity(flags, SPUFS_I(d_inode(dentry))->i_ctx, From patchwork Thu Mar 13 04:30:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 14014291 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BE2B1386DA; Thu, 13 Mar 2025 04:30:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741840223; cv=none; b=hg3x6FGm1Rk9LuGLAdEFIdkLcv8dzFCq6AeQMd5hum/eVe+6Lt6CAhhjFMQP79gMGAkWyM262vU8eFg8Efq1RV3HjsJd9ToUHedIgclFZ2gmPE3c4mo5lBIbGP54mMy3vI/u4QxS0ZNy4hmVoeS5kwww0JCJpc5xthm+boJPeNs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741840223; c=relaxed/simple; bh=+eIHF7nusOT6vkHRkV5HmWigcK0e1K7mHyfI6uS0j5c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oNlu/P/DmkxEiyC5CAVl2D9SoVbHwlIGOPq3OXa3UcevopD8swNHia6m5+Wxt4Tdt1atFsaJYeydIpD5lK0rP44F3cbq3IDmjeP9h/jtyLAITz5s4LlEVnV7b0pZJ+J6+hE588++wMZRdVquV6knUvayEutnLtsRPWP2VuYkaxg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=HkwK9EnP; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="HkwK9EnP" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=JGDZKjK6OCs68zG/tr6xM+cq3fLRGiU5AsrbLJq3hy0=; b=HkwK9EnP5vbTyY+IQ4Ts3B8yEt cMFsHQrQ9zON/qh8NEEuPZqS2c6Lb0iVW//HoNU/rtS7Z1mZIbRESC4btevcOK6oi6hSAt3jKf3rj w5wJ3KLN03oxyrtz62SPyVrDhIDWXNGoRK9YMYV5xhT1+PfT/AmBl/CPI4IHZdef72P2cqxI3Yymp D3evmXAi63k5BToVAZKto0VLJUz9wrJWnVmffK1+cZQ8iHTtO4gkb2Ezj+nd/BZp67Tmij5OBHXEi Myd+uunLSoVESuDxXeSbOEXgaEmSeWSM6I9csAHxXBt612qWT5qb+s+7zKQlr5U3zn/ZMgMPuUgMI B14QSTXg==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98.1 #2 (Red Hat Linux)) id 1tsaD6-00000008uvz-2NjH; Thu, 13 Mar 2025 04:30:20 +0000 Date: Thu, 13 Mar 2025 04:30:20 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: linux-rdma@vger.kernel.org Subject: [PATCH 4/4] qibfs: fix _another_ leak Message-ID: <20250313043020.GD2123707@ZenIV> References: <20250313042702.GU2023217@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20250313042702.GU2023217@ZenIV> Sender: Al Viro failure to allocate inode => leaked dentry... this one had been there since the initial merge; to be fair, if we are that far OOM, the odds of failing at that particular allocation are low... Signed-off-by: Al Viro Reviewed-by: Christian Brauner --- drivers/infiniband/hw/qib/qib_fs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/infiniband/hw/qib/qib_fs.c b/drivers/infiniband/hw/qib/qib_fs.c index b27791029fa9..b9f4a2937c3a 100644 --- a/drivers/infiniband/hw/qib/qib_fs.c +++ b/drivers/infiniband/hw/qib/qib_fs.c @@ -55,6 +55,7 @@ static int qibfs_mknod(struct inode *dir, struct dentry *dentry, struct inode *inode = new_inode(dir->i_sb); if (!inode) { + dput(dentry); error = -EPERM; goto bail; }