From: Alexandra Winter <wintera@linux.ibm.com>
To: sashiko-reviews@lists.linux.dev
Cc: Alexander Gordeev <agordeev@linux.ibm.com>,
Heiko Carstens <hca@linux.ibm.com>,
linux-s390@vger.kernel.org, Vasily Gorbik <gor@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>
Subject: Re: [PATCH net-next] dibs: Avoid inconsistent lockstate warning in dibs_lo_move_data()
Date: Tue, 8 Sep 2026 11:55:27 +0200 [thread overview]
Message-ID: <490a5c66-c415-42c6-883e-1927d9517322@linux.ibm.com> (raw)
In-Reply-To: <20260905094515.D65911F00A3D@smtp.kernel.org>
On 05.09.26 11:45, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
>
> Pre-existing issues:
> - [High] Unsafe error path calling kfree() on memory allocated via folio_alloc().
> --
>
> commit 71f881ca9b5f87a2235598ada197106f8482dccb
> Author: Alexandra Winter <wintera@linux.ibm.com>
>
> dibs: Avoid inconsistent lockstate warning in dibs_lo_move_data()
>
> dibs->lock is acquired in process context and interrupt context
> (ism_handle_irq()). So always use spin_lock_irqsave() in process context.
>
> Note that this is not a real deadlock, as dibs_lo devices don't have
> any interrupt context.
>
> [ ... ]
>
>> diff --git a/drivers/dibs/dibs_loopback.c b/drivers/dibs/dibs_loopback.c
>> index 649e4e375be33..44a2e74c2efcb 100644
>> --- a/drivers/dibs/dibs_loopback.c
>> +++ b/drivers/dibs/dibs_loopback.c
>
> [ ... ]
>
> While reviewing this commit, I noticed a pre-existing issue in the related
> ism_alloc_dmb() function:
>
> drivers/s390/net/ism_drv.c:ism_alloc_dmb() {
> [ ... ]
> folio = folio_alloc(GFP_KERNEL | __GFP_NOWARN | __GFP_NOMEMALLOC |
> __GFP_NORETRY, get_order(dmb->dmb_len));
>
> if (!folio) {
> rc = -ENOMEM;
> goto out_bit;
> }
>
> dmb->cpu_addr = folio_address(folio);
> dmb->dma_addr = dma_map_page(&ism->pdev->dev,
> virt_to_page(dmb->cpu_addr), 0,
> dmb->dmb_len, DMA_FROM_DEVICE);
> if (dma_mapping_error(&ism->pdev->dev, dmb->dma_addr)) {
> rc = -ENOMEM;
> goto out_free;
> }
>
> return 0;
>
> out_free:
> kfree(dmb->cpu_addr);
> [ ... ]
> }
>
> [Severity: High]
> This is a pre-existing issue, but does calling kfree() on memory directly
> allocated by folio_alloc() cause a kernel panic due to invalid slab metadata?
>
> When dma_map_page() fails, the execution jumps to the out_free label, which
> incorrectly calls kfree(dmb->cpu_addr) instead of using folio_put() as seen
> in ism_free_dmb().
>
> If a user exhausts DMA mapping space (e.g., filling up the IOMMU or exhausting
> bounce buffers), could this error path be triggered resulting in a denial of
> service?
>
Fix for this is is already in netdev:
https://git.kernel.org/netdev/net/c/907a56ab3eb8
next prev parent reply other threads:[~2026-09-08 9:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 9:44 [PATCH net-next] dibs: Avoid inconsistent lockstate warning in dibs_lo_move_data() Alexandra Winter
2026-09-05 0:42 ` Dust Li
2026-09-05 9:45 ` sashiko-bot
2026-09-08 9:55 ` Alexandra Winter [this message]
2026-09-07 6:26 ` Sidraya Jayagond
2026-09-08 12:45 ` netdev-bot+sashiko
2026-09-08 17:04 ` Alexandra Winter
2026-09-09 8:04 ` Paolo Abeni
2026-09-08 13:10 ` patchwork-bot+netdevbpf
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=490a5c66-c415-42c6-883e-1927d9517322@linux.ibm.com \
--to=wintera@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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