[PATCH 07/12] vhost-scsi: improve TMF log allocation error handling comment

Weimin Xiong <[email protected]>
Newsgroups dev.linux.lists.virtualization
Message-ID <[email protected]>
From: xiongweimin <[email protected]>

Add a clarifying comment to explain the error handling flow when TMF
log allocation fails. The tmf structure is freed via vhost_scsi_release_tmf_res()
and then safely falls through to send_reject since it doesn't access tmf
after release.

Signed-off-by: Weimin Xiong <[email protected]>
Co-authored-by: Cursor <[email protected]>
---
 drivers/vhost/scsi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index 77e47f246..219d9d881 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -1620,6 +1620,9 @@ vhost_scsi_handle_tmf(struct vhost_scsi *vs, struct vhost_scsi_tpg *tpg,
 			tmf->tmf_log_num = log_num;
 		} else {
 			pr_err("vhost_scsi tmf log allocation error\n");
+			/* Free tmf and send reject response. The send_reject
+			 * label does not access tmf after this release.
+			 */
 			vhost_scsi_release_tmf_res(tmf);
 			goto send_reject;
 		}
-- 
2.43.0
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.