Re: [BUG] dm: unbounded recursion in dm_blk_ioctl via cyclic DM stacking

Mikulas Patocka <[email protected]>
Newsgroups dev.linux.lists.dm-devel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>

On Tue, 18 Aug 2026, Yu Junzhe wrote:

> Hello,
> 
> I am reporting unbounded recursion in dm_blk_ioctl(): it forwards a 
> block ioctl to the underlying device with no depth or cycle guard. A 
> two-device DM-on-DM cycle then re-enters dm_blk_ioctl until the kernel 
> stack is exhausted.

Hi

There is also unbounded recursion in bio_endio when stacking bio-based 
drivers. Many years ago I tried to fix it, but there was no intereset in 
fixing it.

If you work with block maintainers to fix the bio_endio recursion, I can 
fix the dm_blk_ioctl case.

> Table load rejects only a device mapped onto itself (dm_get_device: dev 
> == disk_devt(t->md->disk)). A->B->A is accepted. bd_link_disk_holder 
> rejects only a disk holding itself.

Regarding A->B->A stacking - the user just shouldn't do recursive 
stacking.

Mikulas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.