Re: [PATCH] scsi: libfc: Fix rport kref leak in fc_rport_enter_ready()

From: Martin K. Petersen (Oracle)

Date: Tue Nov 17 2026 - 23:50:04 EST


On Sun, 08 Nov 2026 03:01:08 -0600, Weidong Wang wrote:

> fc_rport_enter_ready() takes a reference on the rport unconditionally,
> but only queues event_work, whose handler drops that reference, when no
> event is pending. If rdata->event is already set, the && short-circuits
> past both queue_work() and the compensating kref_put(), so the reference
> is leaked and the fc_rport_priv is never freed.
>
> This is reachable from the wire: a PLOGI from a well-known address goes
> straight to fc_rport_enter_ready(), and a second PLOGI for the same
> S_ID while RPORT_EV_READY is still pending enters it again. After the
> rport is logged out, kmemleak reports:
>
> [...]

Applied to 7.4/scsi-fixes, thanks!

[1/1] scsi: libfc: Fix rport kref leak in fc_rport_enter_ready()
https://git.kernel.org/mkp/scsi/c/cbd9818ebed3

--
Martin K. Petersen