Re: [PATCH v2] scsi: libfc: fix directory server rport memory leak

From: Greg KH

Date: Thu Sep 24 2026 - 10:34:52 EST


On Thu, Sep 24, 2026 at 09:34:29PM +0800, Guangshuo Li wrote:
> fc_rport_create() does not add FC_FID_DIR_SERV rports to
> lport->disc.rports. If fc_frame_alloc() fails in
> fc_rport_recv_plogi_req() after creating a directory server rport, its
> initial reference is not released through the normal rport teardown
> path.
>
> Normal rports are added to lport->disc.rports and removed from the list
> before their initial reference is dropped. The directory server rport
> bypasses both operations.
>
> Add directory server rports to lport->disc.rports and use the existing
> list removal path when they are deleted. Keep the existing directory
> server callback and retry behavior unchanged.
>
> The issue was identified by a static analysis tool I developed and
> confirmed by manual review.

Great, please document that as is asked for in the kernel documentation
in the changelog here please.

thanks,

greg k-h