 nvmet-fcloop: Check remoteport port_state before calling done callback · gregkh/linux@f30b951 · GitHub Skip to content Navigation Menu Toggle navigation Sign in Appearance settings Platform AI CODE CREATION GitHub Copilot Write better code with AI GitHub Spark Build and deploy intelligent apps GitHub Models Manage and compare prompts MCP Registry New Integrate external tools DEVELOPER WORKFLOWS Actions Automate any workflow Codespaces Instant dev environments Issues Plan and track work Code Review Manage code changes APPLICATION SECURITY GitHub Advanced Security Find and fix vulnerabilities Code security Secure your code as you build Secret protection  EXPLORE Why GitHub Documentation Blog Changelog Marketplace View all features Solutions BY COMPANY SIZE Enterprises Small and medium teams Startups Nonprofits BY USE CASE App Modernization DevSecOps DevOps CI/CD View all use cases BY INDUSTRY Healthcare Financial services Manufacturing Government View all industries View all solutions Resources EXPLORE BY TOPIC AI Software Development DevOps Security View all topics EXPLORE BY TYPE Customer stories Events &amp; webinars Ebooks &amp; reports Business insights GitHub Skills SUPPORT &amp; SERVICES Documentation Customer support Community forum Trust center Partners View all resources Open Source COMMUNITY GitHub Sponsors Fund open source developers PROGRAMS Security Lab Maintainer Community Accelerator GitHub Stars Archive Program REPOSITORIES Topics Trending Collections Enterprise ENTERPRISE SOLUTIONS Enterprise platform AI-powered developer platform AVAILABLE ADD-ONS GitHub Advanced Security Enterprise-grade security features Copilot for Business Enterprise-grade AI features Premium Support Enterprise-grade 24/7 support Pricing Search or jump to... Search code, repositories, users, issues, pull requests... --> Search Clear Search syntax tips Provide feedback --> We read every piece of feedback, and take your input very seriously.  Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly --> Name Query To see all available qualifiers, see our documentation . Cancel Create saved search Sign in Sign up Appearance settings Resetting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} gregkh / linux Public Notifications You must be signed in to change notification settings Fork 686 Star 644 Code Actions Security and quality 0 Insights Additional navigation options Code Actions Security and quality Insights Commit f30b951 Browse files Browse files Justin Tee authored and Sasha Levin committed nvmet-fcloop: Check remoteport port_state before calling done callback [ Upstream commit dd677d0 ] In nvme_fc_handle_ls_rqst_work, the lsrsp-&gt;done callback is only set when remoteport-&gt;port_state is FC_OBJSTATE_ONLINE. Otherwise, the nvme_fc_xmt_ls_rsp's LLDD call to lport-&gt;ops-&gt;xmt_ls_rsp is expected to fail and the nvme-fc transport layer itself will directly call nvme_fc_xmt_ls_rsp_free instead of relying on LLDD's done callback to free the lsrsp resources. Update the fcloop_t2h_xmt_ls_rsp routine to check remoteport-&gt;port_state. If online, then lsrsp-&gt;done callback will free the lsrsp. Else, return -ENODEV to signal the nvme-fc transport to handle freeing lsrsp. Cc: Ewan D. Milne &lt;emilne@redhat.com&gt; Tested-by: Aristeu Rozanski &lt;aris@redhat.com&gt; Acked-by: Aristeu Rozanski &lt;aris@redhat.com&gt; Reviewed-by: Daniel Wagner &lt;dwagner@suse.de&gt; Closes: https://lore.kernel.org/linux-nvme/21255200-a271-4fa0-b099-97755c8acd4c@work/ Fixes: 10c165a ("nvmet-fcloop: call done callback even when remote port is gone") Signed-off-by: Justin Tee &lt;justintee8345@gmail.com&gt; Signed-off-by: Keith Busch &lt;kbusch@kernel.org&gt; Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt; 1 parent 72d08d2 commit f30b951 Copy full SHA for f30b951 1 file changed + 11 - 4 Lines changed: 11 additions &amp; 4 deletions File tree Expand file tree Collapse file tree Open diff view settings Filter options drivers/nvme/target fcloop.c Expand file tree Collapse file tree Open diff view settings Collapse file ‎ drivers/nvme/target/fcloop.c ‎ Copy file name to clipboard Expand all lines: drivers/nvme/target/fcloop.c + 11 - 4 Lines changed: 11 additions &amp; 4 deletions Original file line number Diff line number Diff line change @@ -492,6 +492,7 @@ fcloop_t2h_xmt_ls_rsp(struct nvme_fc_local_port *localport, 492 492 struct fcloop_rport * rport = remoteport -&gt; private ; 493 493 struct nvmet_fc_target_port * targetport = rport -&gt; targetport ; 494 494 struct fcloop_tport * tport ; 495 + int ret = 0 ; 495 496 496 497 if (! targetport ) { 497 498 /* @@ -501,12 +502,18 @@ fcloop_t2h_xmt_ls_rsp(struct nvme_fc_local_port *localport, 501 502 * We end up here from delete association exchange: 502 503 * nvmet_fc_xmt_disconnect_assoc sends an async request. 503 504 * 504 - * Return success because this is what LLDDs do; silently 505 - * drop the response. 505 + * Return success when remoteport is still online because this 506 + * is what LLDDs do and silently drop the response. Otherwise, 507 + * return with error to signal upper layer to perform the lsrsp 508 + * resource cleanup. 506 509 */ 507 - lsrsp -&gt; done ( lsrsp ); 510 + if ( remoteport -&gt; port_state == FC_OBJSTATE_ONLINE ) 511 + lsrsp -&gt; done ( lsrsp ); 512 + else 513 + ret = - ENODEV ; 514 + 508 515 kmem_cache_free ( lsreq_cache , tls_req ); 509 - return 0 ; 516 + return ret ; 510 517 } 511 518 512 519 memcpy ( lsreq -&gt; rspaddr , lsrsp -&gt; rspbuf , 0 commit comments Comments 0 ( 0 ) Footer &copy; 2026 GitHub,&nbsp;Inc. Footer navigation Terms Privacy Security Status Community Docs Contact Manage cookies Do not share my personal information You can’t perform that action at this time. 