Re: [PATCH RFC 01/38] PCI/proc: don't truncate the position of config space accesses
From: Linus Torvalds
Date: Mon Nov 02 2026 - 15:58:41 EST
On Mon, 2 Nov 2026 at 06:22, Christian Brauner <brauner@xxxxxxxxxx> wrote:
>
> proc_bus_pci_write() truncates the file position to an int. A pwrite()
> at an offset like 0xfffff000 turns it negative [..]
I think this would actually be better with rw_verify_area() just
checking a per-file maxbytes.
We already have that logic for lseek and friends - using that fairly
hacky combination of s_maxbytes and !unsigned_offsets().
We should combine s_maxbytes and unsigned_offsets() at file open time
into f_maxbytes and check that not just at lseek but in
rw_verify_area.
And then things like proc_bus_pci could set it's size limit in one single place.
Hmm?
Linus