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


Reply via email to