mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wang Zhaolong <wangzhaolong1@huawei.com>
To: Steve French <smfrench@gmail.com>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	Paulo Alcantara <pc@manguebit.org>
Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com>,
	Shyam Prasad N <sprasad@microsoft.com>,
	Tom Talpey <tom@talpey.com>, Bharath SM <bharathsm@microsoft.com>,
	<linux-cifs@vger.kernel.org>, <samba-technical@lists.samba.org>,
	<linux-kernel@vger.kernel.org>, <kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH next] smb: client: Fix NULL vs ERR_PTR() returns in cifs_get_tcon_super()
Date: Tue, 19 Aug 2025 10:48:13 +0800	[thread overview]
Message-ID: <3059e4f5-8ad7-44f0-80fa-61e3838ed54a@huawei.com> (raw)
In-Reply-To: <CAH2r5muVjS+Y_NFSWwYoisPGfynyTkmynjpQHi2_Kk6Z8AiG0w@mail.gmail.com>

> Since Paulo pointed out a problem with v4 of this patch, an obvious
> question is Dan's patch "independent enough" to take or would it make
> the v5 of your patch harder.  Let me know when there is a v5 of the
> patch so we can do more testing and review
> 
> On Mon, Aug 18, 2025 at 8:30 AM Wang Zhaolong
> <wangzhaolong@huaweicloud.com> wrote:
>>
Hi Steve, Paulo, and Dan,

Thank you very much for your attention to this patch.

The NULL pointer issue has already been addressed in the V4
version of the patch. I have considered submitting a V5 version
of the patch, but I have not yet decided whether to proceed with it.

While further analyzing the code, I discovered the following
potential issues in the implementation of `cifs_tree_connect()` in
`dfs.c`, which calls `cifs_get_dfs_tcon_super()`:

1. `cifs_get_dfs_tcon_super()` only returns a single superblock reference.
    Using this superblock, it retrieves the associated `cifs_sb`. However,
    a single tcon is supposed to be associated with multiple `cifs_sb`
    instances. I am unsure whether there is a mechanism that guarantees a
    DFS tcon (where `tcon->origin_fullpath` is non-NULL) has exactly one
    associated `cifs_sb`. My current patch series only retrieves the first
    `cifs_sb` that satisfies the condition, which may not be sufficient.

2. The only purpose of retrieving the `cifs_sb` is to update the `prepath`
    field of the `cifs_sb` in `tree_connect_dfs_target()` by calling
    `cifs_update_super_prepath()`. No other information from the VFS-layer
    superblock is used. However, retrieving the superblock is also meant to
    pin it in memory to prevent it from being released. Therefore, I am
    considering whether to simplify the process of updating the prepath.

If I decide to submit a V5 version of the patch, I will need to fully investigate:
1. Whether a DFS tcon can be associated with multiple `cifs_sb` instances.
2. If multiple `cifs_sb` instances are associated with a DFS tcon, whether
    the `prepath` field of all associated `cifs_sb` instances needs to be
     updated.

Only after thoroughly understanding these two points can I come up with a
better implementation for the V5 patch.

Resolving these questions will take some time. If anyone can provide
guidance or assistance, I would greatly appreciate it.

Best regards,
Wang Zhaolong
Wang Zhaolong

  reply	other threads:[~2025-08-19  2:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-18  9:59 Dan Carpenter
2025-08-18 13:03 ` Wang Zhaolong
2025-08-18 21:41   ` Steve French
2025-08-19  2:48     ` Wang Zhaolong [this message]
2025-08-19  5:27     ` Dan Carpenter

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=3059e4f5-8ad7-44f0-80fa-61e3838ed54a@huawei.com \
    --to=wangzhaolong1@huawei.com \
    --cc=bharathsm@microsoft.com \
    --cc=dan.carpenter@linaro.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pc@manguebit.org \
    --cc=ronniesahlberg@gmail.com \
    --cc=samba-technical@lists.samba.org \
    --cc=smfrench@gmail.com \
    --cc=sprasad@microsoft.com \
    --cc=tom@talpey.com \
    /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

all inboxes | Powered by JetHome®