nvme-tcp: fix a possible UAF when failing to send request

zhang.guanghui at cestc.cn zhang.guanghui at cestc.cn
Tue Feb 11 00:04:35 PST 2025


Hi 



    This is a  race issue,  I can't reproduce it stably yet. I have not tested the latest kernel.  but in fact,  I've synced some nvme-tcp patches from  lastest upstream, 



But in fact, the issue still exists. I review nvme-tcp code and found that this issues may exist in nvme_tcp_poll processing. 







zhang.guanghui at cestc.cn



 



From: Xu Chunguang



Date: 2025-02-11 15:20



To: Maurizio Lombardi



CC: Max Gurtovoy; zhang.guanghui; sagi; kbusch; sashal; linux-kernel; linux-nvme; linux-block



Subject: Re: nvme-tcp: fix a possible UAF when failing to send request







Hi: 







Does  you have tested the latest kernel, can it  reproduce the same issue?







Maurizio Lombardi <mlombard at bsdbackstore.eu> 于 2025年2月11日周二 00:40写道:





On Mon Feb 10, 2025 at 11:24 AM CET, Max Gurtovoy wrote:



>



> It seems to me that the HOST_PATH_ERROR handling can be improved in



> nvme-tcp.



>



> In nvme-rdma we use nvme_host_path_error(rq) and nvme_cleanup_cmd(rq) in



> case we fail to submit a command..



>



> can you try to replacing nvme_tcp_end_request(blk_mq_rq_from_pdu(req),



> NVME_SC_HOST_PATH_ERROR); call with the similar logic we use in



> nvme-rdma for host path error handling ?





Yes, I could try to prepare a patch.





In any case, I think the main issue here is that nvme_tcp_poll()



should be prevented from racing against io_work... and I also think



there is a possible race condition if nvme_tcp_poll() races against



the controller resetting code.





Maurizio




More information about the Linux-nvme mailing list