diff mbox series

[4/5] cifs: Fix xid leak in cifs_ses_add_channel()

Message ID 20221017144525.414313-5-zhangxiaoxu5@huawei.com
State New
Headers show
Series cifs: Fix xid leak in cifs | expand

Commit Message

zhangxiaoxu (A) Oct. 17, 2022, 2:45 p.m. UTC
Before return, should free the xid, otherwise, the
xid will be leaked.

Fixes: d70e9fa55884 ("cifs: try opening channels after mounting")
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
---
 fs/cifs/sess.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Steve French Oct. 17, 2022, 5:28 p.m. UTC | #1
Your approach is probably better, but it would also possible to remove
the get_xid and pass 0 in to negotiate in this path

On Mon, Oct 17, 2022 at 8:42 AM Zhang Xiaoxu <zhangxiaoxu5@huawei.com> wrote:
>
> Before return, should free the xid, otherwise, the
> xid will be leaked.
>
> Fixes: d70e9fa55884 ("cifs: try opening channels after mounting")
> Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
> ---
>  fs/cifs/sess.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
> index 0435d1dfa9e1..92e4278ec35d 100644
> --- a/fs/cifs/sess.c
> +++ b/fs/cifs/sess.c
> @@ -496,6 +496,7 @@ cifs_ses_add_channel(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses,
>                 cifs_put_tcp_session(chan->server, 0);
>         }
>
> +       free_xid(xid);
>         return rc;
>  }
>
> --
> 2.31.1
>
diff mbox series

Patch

diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 0435d1dfa9e1..92e4278ec35d 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -496,6 +496,7 @@  cifs_ses_add_channel(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses,
 		cifs_put_tcp_session(chan->server, 0);
 	}
 
+	free_xid(xid);
 	return rc;
 }