Re: [PATCH v3 10/40] drivers/usb/mon: update to use mmap_prepare + map kernel pages
From: Lorenzo Stoakes (ARM)
Date: Fri Oct 02 2026 - 08:16:43 EST
On Fri, Oct 02, 2026 at 05:55:56PM +0800, Lance Yang wrote:
>
>
> On 2026/9/18 00:22, Lorenzo Stoakes (ARM) wrote:
> [...]
> > +static int mon_bin_discontig_init(void *vm_private_data, void **private)
> > +{
> > + struct mon_reader_bin *rp = vm_private_data;
> > +
> > + /* Dropped by mon_bin_vma_close() on unmap, including on error. */
> > + __mon_bin_vma_open(rp);
>
> Em ... If Coda uses a usbmon container and the first page insertion fails
> (e.g. -ENOMEM when allocating a page table) after mon_bin_discontig_init(),
> where is mmap_active decremented?
>
> mmap_action_finish() returns the error when is_compat is true, and
> mmap_file() then replaces vm_ops with dummy ops.
>
> Am i missing something?
No, indeed, the contract isn't honoured in the compat path.
It can't actually happen in practice - the compat layer is only ever
accessed from a stacked filesystem and those only stack on regular files.
But I should probably update this to be strictly correct regardless to be
consistent with the non-compat path.
Let me see if that looks sensible and rejig for v4, thanks! :)
>
> > + return 0;
> > +}
>
> Cheers, Lance
>
> [...]
--
Cheers, Lorenzo