From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 16B738486 for ; Thu, 27 Oct 2022 16:59:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AF38C433C1; Thu, 27 Oct 2022 16:59:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666889990; bh=S0pqGxxLTEj//pKEhrAQOw70Y8YQ6flZd0994+ERZJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T0hFMtz8pi0njfJogPpN+FirkOvgoI5ZA/rfTPQFLaMDWOVdsNhk0TuxYW7EMXfwd ZmsCQCP0blLZPBWftN3gzoG5No10lSrzMvKspLzomF3emtILWyDzA77nxS8+Qr2c3r GQJY0/dB85bbvZI6mSwo7SayAnSexA5b5HLAhHwM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Paulo Alcantara (SUSE)" , Zhang Xiaoxu , Steve French , Sasha Levin Subject: [PATCH 6.0 58/94] cifs: Fix xid leak in cifs_create() Date: Thu, 27 Oct 2022 18:55:00 +0200 Message-Id: <20221027165059.514838232@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221027165057.208202132@linuxfoundation.org> References: <20221027165057.208202132@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Zhang Xiaoxu [ Upstream commit fee0fb1f15054bb6a0ede452acb42da5bef4d587 ] If the cifs already shutdown, we should free the xid before return, otherwise, the xid will be leaked. Fixes: 087f757b0129 ("cifs: add shutdown support") Reviewed-by: Paulo Alcantara (SUSE) Signed-off-by: Zhang Xiaoxu Signed-off-by: Steve French Signed-off-by: Sasha Levin --- fs/cifs/dir.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 08f7392716e2..05c78a18ade0 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -551,8 +551,10 @@ int cifs_create(struct user_namespace *mnt_userns, struct inode *inode, cifs_dbg(FYI, "cifs_create parent inode = 0x%p name is: %pd and dentry = 0x%p\n", inode, direntry, direntry); - if (unlikely(cifs_forced_shutdown(CIFS_SB(inode->i_sb)))) - return -EIO; + if (unlikely(cifs_forced_shutdown(CIFS_SB(inode->i_sb)))) { + rc = -EIO; + goto out_free_xid; + } tlink = cifs_sb_tlink(CIFS_SB(inode->i_sb)); rc = PTR_ERR(tlink); -- 2.35.1