All of lore.kernel.org
 help / color / mirror / Atom feed
From: Youling Tang <youling.tang@linux.dev>
To: linkinjeon@kernel.org, pc@manguebit.org,
	ronniesahlberg@gmail.com, sprasad@microsoft.com, tom@talpey.com,
	bharathsm@microsoft.com, metze@samba.org,
	chenxiaosong@chenxiaosong.com
Cc: linux-cifs@vger.kernel.org, Youling Tang <tangyouling@kylinos.cn>,
	ChenXiaoSong <chenxiaosong@kylinos.cn>
Subject: [PATCH 3/3] smb/client: remove redundant MR release from cifs_free_subrequest()
Date: Fri,  4 Dec 2026 16:41:11 +0800	[thread overview]
Message-ID: <20261204084111.1483103-4-youling.tang@linux.dev> (raw)
In-Reply-To: <20261204084111.1483103-1-youling.tang@linux.dev>

From: Youling Tang <tangyouling@kylinos.cn>

See the procedure below:

  smb2_readv_callback // I/O completes
    smb2_release_io_mr
      smbd_deregister_mr(subreq->mr);
      subreq->mr = NULL;

  smb2_async_readv // submission fails
    smb2_release_io_mr
      smbd_deregister_mr(subreq->mr);
      subreq->mr = NULL;

  netfs_put_subrequest // last reference
    netfs_free_subrequest
      cifs_free_subrequest // MR pointer is NULL

Signed-off-by: Youling Tang <tangyouling@kylinos.cn>
Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
---
 fs/smb/client/file.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index fc63b238391d..c7bb478d8baa 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -769,15 +769,6 @@ static void cifs_free_subrequest(struct netfs_io_subrequest *subreq)
 		container_of(subreq, struct cifs_io_subrequest, subreq);
 	int rc = subreq->error;
 
-	if (rdata->subreq.source == NETFS_DOWNLOAD_FROM_SERVER) {
-#ifdef CONFIG_CIFS_SMB_DIRECT
-		if (rdata->mr) {
-			smbd_deregister_mr(rdata->mr);
-			rdata->mr = NULL;
-		}
-#endif
-	}
-
 	if (rdata->credits.value != 0) {
 		trace_smb3_rw_credits(rdata->rreq->debug_id,
 				      rdata->subreq.debug_index,
-- 
2.55.0


      parent reply	other threads:[~2026-12-04  8:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  8:41 [PATCH 0/3] fix refcount leak in smb2_async_readv() and smb2_async_writev() Youling Tang
2026-12-04  8:41 ` [PATCH 1/3] smb/client: factor out smb2_release_io_mr() Youling Tang
2026-12-04  8:41 ` [PATCH 2/3] smb/client: fix refcount leak in smb2_async_readv() and smb2_async_writev() Youling Tang
2026-12-04  8:41 ` Youling Tang [this message]

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=20261204084111.1483103-4-youling.tang@linux.dev \
    --to=youling.tang@linux.dev \
    --cc=bharathsm@microsoft.com \
    --cc=chenxiaosong@chenxiaosong.com \
    --cc=chenxiaosong@kylinos.cn \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=metze@samba.org \
    --cc=pc@manguebit.org \
    --cc=ronniesahlberg@gmail.com \
    --cc=sprasad@microsoft.com \
    --cc=tangyouling@kylinos.cn \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.