From: Greg KH <gregkh@linuxfoundation.org>
To: Alexander Antonakakis <alexis@maich.gr>
Cc: stable@vger.kernel.org, regressions@lists.linux.dev,
linux-scsi@vger.kernel.org, sashal@kernel.org
Subject: Re: [REGRESSION] 6.1.178+: lpfc: boot hang due to use-after-free of mboxq in lpfc_sli4_driver_resource_setup() backport
Date: Tue, 20 Oct 2026 13:45:36 +0200 [thread overview]
Message-ID: <2026102021-audio-banish-24e2@gregkh> (raw)
In-Reply-To: <29f6c901-5209-4681-81cc-ff768cd405f4@maich.gr>
On Tue, Oct 20, 2026 at 01:23:03PM +0300, Alexander Antonakakis wrote:
>
> Hello,
>
> Since 6.1.178, servers with an Emulex SLI-4 Fibre Channel HBA hang
> during boot when the lpfc driver initializes. 6.1.177 works.
> 6.1.180, 6.1.187 and 6.1.190 (Debian 12 kernels 6.1.0-52 to -54)
> all hang in the same way.
>
> Hardware:
> Emulex LPe31000/LPe32000 Series 16Gb/32Gb Fibre Channel Adapter
> Firmware 14.4.322.17, sli-4:2:c
> lpfc 14.2.0.7
>
> The cause appears to be the 6.1.y backport of:
>
> 299f5baa1321 ("scsi: lpfc: Fix memory leak in
> lpfc_sli4_driver_resource_setup()")
>
> upstream commit 1bd28625e25be549ee7c47532e7c3ef91c682410
>
> In mainline, the new mempool_free(mboxq, ...) is placed after the
> call to lpfc_get_sli4_parameters(phba, mboxq) and its error check.
> In the 6.1.y backport it landed before that call. In
> drivers/scsi/lpfc/lpfc_init.c at v6.1.178:
>
> 8178: mempool_free(mboxq, phba->mbox_mem_pool);
> 8187: rc = lpfc_get_sli4_parameters(phba, mboxq);
> 8200: mempool_free(mboxq, phba->mbox_mem_pool); /* error path */
> 8207: mempool_free(mboxq, phba->mbox_mem_pool); /* error path */
>
> So mboxq is freed, then used for a mailbox command to the HBA
> (use-after-free), and may be freed again on the error paths
> (double free). This runs on every SLI-4 HBA probe, which matches
> the hang about 2 seconds into boot.
>
> Moving the mempool_free() at line 8178 to after the
> lpfc_get_sli4_parameters() call and its error handling, as in
> mainline, should fix it. Other stable branches that took this
> backport may be worth checking for the same placement.
Great, can you send a fix for this?
thanks,
greg k-h
prev parent reply other threads:[~2026-10-20 11:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-20 10:23 [REGRESSION] 6.1.178+: lpfc: boot hang due to use-after-free of mboxq in lpfc_sli4_driver_resource_setup() backport Alexander Antonakakis
2026-10-20 11:39 ` Andrey Misiurov
2026-10-20 11:45 ` Alexander Antonakakis
2026-10-20 11:45 ` Greg KH [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2026102021-audio-banish-24e2@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=alexis@maich.gr \
--cc=linux-scsi@vger.kernel.org \
--cc=regressions@lists.linux.dev \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox