Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3ED7D429000; Sat, 12 Sep 2026 11:10:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789211420; cv=none; b=qidfj5f76LHBOV4gjlOAxAJjK3rkTTPaXk7zHj7jcSZvan0kVYra6H+aV32Bwti78f+KWwOtIC0j4wMwocUopinpiqa/DXrsnI+DoIiXBzxCAY2VDp4mbHrTEOi3hxJJ9t3tI89j4tDmXu6cWIALNdgv4wAalg3pAhD4jXH+OC0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789211420; c=relaxed/simple; bh=umzBojr65zpZVGP9GiWY6I1DobXXCCA5c0rsFSqXuiU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QJET2kHT3x9bdAvHF4b99MoDdmHu4mRnsMQFuND8K12mhYo5rFbWx/SG/+b7T630k6nDmi+UwCww4qlb+USKvzXemdgBJA8km5wUwqQKS+joN1qRSvh0wBsmhlT2B0HubNoYdrkkIEdJnXXRS6mCBBX1hMf7A8wdOlKOePnz+rA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=BXokIGQx; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="BXokIGQx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FA8A1F000FF; Sat, 12 Sep 2026 11:10:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789211419; bh=JprlTAZ35dt0hXvQepiPP0+YzkElIN/ufmrXewxjEO8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BXokIGQx8F4GlmKXDz8zG7rsEhr/qe2yamiQgfwczzUvzXjKWnxyH86+8piR+aShl seq8FGt/WLU4iVkqsPYebt0G5sZYvOWXrirwp9UhpBRnv/CyZLlVnvRM10L99+Zboq qv4ka5R3rK6R3peoR/OGzx6hz7KT7/vWOsBOPQ5o= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Guangshuo Li , Namjae Jeon , Sasha Levin Subject: [PATCH 6.18 1226/1518] ksmbd: Do not skip lock checks for single-byte ranges Date: Sat, 12 Sep 2026 08:56:35 +0200 Message-ID: <20260912065651.237147331@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065623.398859879@linuxfoundation.org> References: <20260912065623.398859879@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Guangshuo Li [ Upstream commit d40c24634fe077a0dc91fd11fccf44ce12b454d5 ] 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 Signed-off-by: Namjae Jeon Signed-off-by: Sasha Levin --- fs/smb/server/vfs.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/smb/server/vfs.c b/fs/smb/server/vfs.c index 764eca75291ce..216b6e427aa7e 100644 --- a/fs/smb/server/vfs.c +++ b/fs/smb/server/vfs.c @@ -327,9 +327,6 @@ static int check_lock_range(struct file *filp, loff_t start, loff_t end, struct file_lock_context *ctx = locks_inode_context(file_inode(filp)); int error = 0; - if (start == end) - return 0; - if (!ctx || list_empty_careful(&ctx->flc_posix)) return 0; -- 2.53.0