Re: [PATCH] ksmbd: Do not skip lock checks for single-byte ranges
Namjae Jeon <[email protected]>
| Newsgroups | org.kernel.vger.linux-cifs,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAKYAXd_66zHKLSCw-aF5J=kAMKTeDbHTGGGm-YtdY-GLhEukpA@mail.gmail.com> |
On Sun, Jul 5, 2026 at 8:39 PM Guangshuo Li <[email protected]> wrote: > > check_lock_range() uses inclusive ranges. Its callers pass the end > offset as start + length - 1, so start == end represents a valid > single-byte range rather than an empty range. > > The start == end shortcut therefore skips mandatory byte-range lock > checks for one-byte reads, writes, copychunk operations and one-byte > truncate ranges. A conflicting lock covering that byte is not checked > and the operation is allowed to proceed. > > Remove the shortcut. The truncate size == inode->i_size case is already > handled by only calling check_lock_range() when the new size differs > from the current file size. > > Fixes: 5d510ac31626 ("ksmbd: skip lock-range check on equal size to avoid size==0 underflow") > Signed-off-by: Guangshuo Li <[email protected]> Applied it to #ksmbd-for-next-next. Thanks!