Re: [PATCH v2 2/3] smb/server: deny overwriting targets with non-POSIX opens

Namjae Jeon <[email protected]>
Newsgroups org.kernel.vger.linux-cifs
Message-ID <CAKYAXd9OQKQVURduu0iRL-H8rAL4coCK79w8HZiSt3f8CpdymA@mail.gmail.com>
On Wed, Aug 5, 2026 at 12:09 PM ChenXiaoSong
<[email protected]> wrote:
>
> Hi Namjae,
>
> What do you think about iterating over `global_ft.idr` instead?
Looks ok. I will apply after running my tests tonight.
Thanks!
>
> ```
> ksmbd_has_other_nonposix_open() {
>         read_lock(&global_ft.lock);
>         idr_for_each_entry(global_ft.idr, fp, id) {
>         }
>         read_unlock(&global_ft.lock);
> }
> ```
>
> On 8/5/26 10:17, Namjae Jeon wrote:
> > The new check is limited to the target dentry's
> > ksmbd_inode->m_fp_list. Therefore, it does not cover a struct
> > ksmbd_file opened through another hardlink dentry, even though
> > file_inode(fp->filp) == d_inode(dentry). For example, if file2.link is
> > a hardlink to file2 and file2.link is opened with a non-POSIX context,
> > an overwrite rename of another file to file2 can miss that open
> > handle.
> > This appears to be an existing limitation rather than a regression
> > introduced by this patch. However, since this patch is intended to
> > reject overwrites when the target has a non-POSIX ksmbd_file...
>
> --
> ChenXiaoSong <[email protected]>
> Chinese Homepage: https://chenxiaosong.com
> English Homepage: https://chenxiaosong.com/en
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.