diff options
| author | Linus Torvalds <[email protected]> | 2025-03-05 17:08:09 +0000 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2025-03-05 17:08:09 +0000 |
| commit | c27c66afc449b80f3b4b84d123358c0248f2cf63 (patch) | |
| tree | aa8b693bfec51b1933df6415b7c8da7f7966d799 /net/unix/unix_bpf.c | |
| parent | Merge tag 'x86_microcode_for_v6.14_rc6' of git://git.kernel.org/pub/scm/linux... (diff) | |
| download | kernel-c27c66afc449b80f3b4b84d123358c0248f2cf63.tar.gz kernel-c27c66afc449b80f3b4b84d123358c0248f2cf63.zip | |
fs/pipe: Fix pipe_occupancy() with 16-bit indexes
The pipe_occupancy() logic implicitly relied on the natural unsigned
modulo arithmetic in C, but that doesn't work for the new 'pipe_index_t'
case, since any arithmetic will be done in 'int' (and here we had also
made it 'unsigned int' due to the function call boundary).
So make the modulo arithmetic explicit by casting the result to the
proper type.
Cc: Oleg Nesterov <[email protected]>
Cc: Mateusz Guzik <[email protected]>
Cc: Manfred Spraul <[email protected]>
Cc: Christian Brauner <[email protected]>
Cc: Swapnil Sapkal <[email protected]>
Cc: Alexey Gladkov <[email protected]>
Cc: K Prateek Nayak <[email protected]>
Link: https://lore.kernel.org/all/CAHk-=wjyHsGLx=rxg6PKYBNkPYAejgo7=CbyL3=HGLZLsAaJFQ@mail.gmail.com/
Fixes: 3d252160b818 ("fs/pipe: Read pipe->{head,tail} atomically outside pipe->mutex")
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'net/unix/unix_bpf.c')
0 files changed, 0 insertions, 0 deletions
