Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: ChenXiaoSong <chenxiaosong@chenxiaosong.com>
To: linkinjeon@kernel.org
Cc: Guenter Roeck <linux@roeck-us.net>,
	smfrench@gmail.com, pc@manguebit.org, ronniesahlberg@gmail.com,
	sprasad@microsoft.com, tom@talpey.com, bharathsm@microsoft.com,
	senozhatsky@chromium.org, dhowells@redhat.com,
	linux-cifs@vger.kernel.org,
	ZhangGuoDong <zhangguodong@kylinos.cn>,
	ChenXiaoSong <chenxiaosong@kylinos.cn>
Subject: Re: [PATCH v2 1/1] smb/server: fix refcount leak in smb2_open()
Date: Fri, 27 Feb 2026 12:12:21 +0800	[thread overview]
Message-ID: <90fdfba1-e0be-4656-87fc-1921d233da37@chenxiaosong.com> (raw)
In-Reply-To: <f3604a74-3caa-4737-bfc0-d93feb988176@chenxiaosong.com>

Hi Namjae,

By the way, smb2_open() is over 900 lines long, and we have already 
encountered several memory leaks in it, and there may be more. Perhaps 
we should consider refactoring it to make it easier to maintain.

What do you think?

Thanks,
ChenXiaoSong <chenxiaosong@chenxiaosong.com>

On 2026/2/27 12:07, ChenXiaoSong wrote:
> Hi Guenter,
> 
> Sorry for the late reply. I had some family matters to take care of 
> yesterday.
> 
> Please see the following process:
> 
> ```
> smb2_open
>    smb2_check_durable_oplock
>      opinfo_get(fp) // inc refcount
>    ksmbd_reopen_durable_fd
>      __open_id(&work->sess->file_table, fp,
>        idr_alloc_cyclic(ft->idr, fp, ...)
>        __open_id_set(fp, id, type); // insert into file table
>    ksmbd_override_fsids // fail
>    ksmbd_put_durable_fd
>      __ksmbd_close_fd
>        __ksmbd_remove_fd  // remove dh_info.fp from file table
>    // dh_info.fp has already been removed from the file table
>    ksmbd_fd_put(..., fp) // fp == NULL
> ```

  reply	other threads:[~2026-02-27  4:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-29  3:15 [PATCH v2 0/1] smb/server: fix some refcount leaks chenxiaosong.chenxiaosong
2025-12-29  3:15 ` [PATCH v2 1/1] smb/server: fix refcount leak in smb2_open() chenxiaosong.chenxiaosong
2025-12-29  4:06   ` Namjae Jeon
2026-02-25 16:49   ` Guenter Roeck
2026-02-26  4:12     ` ChenXiaoSong
2026-02-26  4:27       ` Guenter Roeck
2026-02-26  5:09       ` Guenter Roeck
2026-02-27  4:07         ` ChenXiaoSong
2026-02-27  4:12           ` ChenXiaoSong [this message]
2026-02-27  4:43             ` Namjae Jeon
2026-02-27  4:42           ` Guenter Roeck
2026-02-27  4:53             ` ChenXiaoSong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=90fdfba1-e0be-4656-87fc-1921d233da37@chenxiaosong.com \
    --to=chenxiaosong@chenxiaosong.com \
    --cc=bharathsm@microsoft.com \
    --cc=chenxiaosong@kylinos.cn \
    --cc=dhowells@redhat.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=pc@manguebit.org \
    --cc=ronniesahlberg@gmail.com \
    --cc=senozhatsky@chromium.org \
    --cc=smfrench@gmail.com \
    --cc=sprasad@microsoft.com \
    --cc=tom@talpey.com \
    --cc=zhangguodong@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox