Message ID | CAH2r5msUp2xqY062MRRXkNApwekZ_CJYL3q_J0boGFPzw4W1LQ@mail.gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | cifs: Fix printing Status code into dmesg | expand |
Just to note that I have sent this patch in series with "cifs: Add missing NT_STATUS_* codes from nterr.h to nterr.c" patch which is adding also NT_STATUS_STOPPED_ON_SYMLINK (mentioned in commit message): https://lore.kernel.org/linux-cifs/20241227173709.22892-1-pali@kernel.org/t/#u On Sunday 19 January 2025 19:48:39 Steve French wrote: > Any thoughts on the attached patch (which is tentatively in > cifs-2.6.git for-next)? > > NT Status code is 32-bit number, so for comparing two NT Status codes is > needed to check all 32 bits, and not just low 24 bits. > > Before this change kernel printed message: > "Status code returned 0x8000002d NT_STATUS_NOT_COMMITTED" > > It was incorrect as because NT_STATUS_NOT_COMMITTED is defined as > 0xC000002d and 0x8000002d has defined name NT_STATUS_STOPPED_ON_SYMLINK. > > With this change kernel prints message: > "Status code returned 0x8000002d NT_STATUS_STOPPED_ON_SYMLINK" > > Signed-off-by: Pali Rohár <pali@kernel.org> > > > -- > Thanks, > > Steve
On Mon, Jan 20, 2025 at 11:55 AM Pali Rohár <pali@kernel.org> wrote: > > Just to note that I have sent this patch in series with "cifs: Add > missing NT_STATUS_* codes from nterr.h to nterr.c" patch which is adding > also NT_STATUS_STOPPED_ON_SYMLINK (mentioned in commit message): > > https://lore.kernel.org/linux-cifs/20241227173709.22892-1-pali@kernel.org/t/#u Both of these are in for-next > On Sunday 19 January 2025 19:48:39 Steve French wrote: > > Any thoughts on the attached patch (which is tentatively in > > cifs-2.6.git for-next)? > > > > NT Status code is 32-bit number, so for comparing two NT Status codes is > > needed to check all 32 bits, and not just low 24 bits. > > > > Before this change kernel printed message: > > "Status code returned 0x8000002d NT_STATUS_NOT_COMMITTED" > > > > It was incorrect as because NT_STATUS_NOT_COMMITTED is defined as > > 0xC000002d and 0x8000002d has defined name NT_STATUS_STOPPED_ON_SYMLINK. > > > > With this change kernel prints message: > > "Status code returned 0x8000002d NT_STATUS_STOPPED_ON_SYMLINK" > > > > Signed-off-by: Pali Rohár <pali@kernel.org> > > > > > > -- > > Thanks, > > > > Steve
It's actually not a 24-bit code or a 32-bit, it's a structure with 4 bits of flags, 12 bits of "facility" and 16 bits of "code" (which btw means 28 bits not 24). And then the NTSTATUS shares its space with the HRESULT based on the "N" flag - see MS-ERREF sections 2.1 and 2.3. These are constantly being added-to. So, it's entirely correct to treat these as a 32-bit quantity. It did surprise me that these two codes differ only by the "warning" vs "error" severity value, yet they indicate entirely different situations. Very, very odd. Fix looks like best approach. Feel free to add my Acked-by: Tom Talpey <tom@talpey.com> Tom. On 1/21/2025 12:45 AM, Steve French wrote: > On Mon, Jan 20, 2025 at 11:55 AM Pali Rohár <pali@kernel.org> wrote: >> >> Just to note that I have sent this patch in series with "cifs: Add >> missing NT_STATUS_* codes from nterr.h to nterr.c" patch which is adding >> also NT_STATUS_STOPPED_ON_SYMLINK (mentioned in commit message): >> >> https://lore.kernel.org/linux-cifs/20241227173709.22892-1-pali@kernel.org/t/#u > > Both of these are in for-next > >> On Sunday 19 January 2025 19:48:39 Steve French wrote: >>> Any thoughts on the attached patch (which is tentatively in >>> cifs-2.6.git for-next)? >>> >>> NT Status code is 32-bit number, so for comparing two NT Status codes is >>> needed to check all 32 bits, and not just low 24 bits. >>> >>> Before this change kernel printed message: >>> "Status code returned 0x8000002d NT_STATUS_NOT_COMMITTED" >>> >>> It was incorrect as because NT_STATUS_NOT_COMMITTED is defined as >>> 0xC000002d and 0x8000002d has defined name NT_STATUS_STOPPED_ON_SYMLINK. >>> >>> With this change kernel prints message: >>> "Status code returned 0x8000002d NT_STATUS_STOPPED_ON_SYMLINK" >>> >>> Signed-off-by: Pali Rohár <pali@kernel.org> >>> >>> >>> -- >>> Thanks, >>> >>> Steve > > >
From 6fa9d8a3cb21ff21dbfa57555f6a41615b829525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org> Date: Thu, 26 Dec 2024 14:27:16 +0100 Subject: [PATCH 42/71] cifs: Fix printing Status code into dmesg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NT Status code is 32-bit number, so for comparing two NT Status codes is needed to check all 32 bits, and not just low 24 bits. Before this change kernel printed message: "Status code returned 0x8000002d NT_STATUS_NOT_COMMITTED" It was incorrect as because NT_STATUS_NOT_COMMITTED is defined as 0xC000002d and 0x8000002d has defined name NT_STATUS_STOPPED_ON_SYMLINK. With this change kernel prints message: "Status code returned 0x8000002d NT_STATUS_STOPPED_ON_SYMLINK" Signed-off-by: Pali Rohár <pali@kernel.org> --- fs/smb/client/netmisc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/smb/client/netmisc.c b/fs/smb/client/netmisc.c index 0ff3ccc7a356..4832bc9da598 100644 --- a/fs/smb/client/netmisc.c +++ b/fs/smb/client/netmisc.c @@ -775,10 +775,10 @@ cifs_print_status(__u32 status_code) int idx = 0; while (nt_errs[idx].nt_errstr != NULL) { - if (((nt_errs[idx].nt_errcode) & 0xFFFFFF) == - (status_code & 0xFFFFFF)) { + if (nt_errs[idx].nt_errcode == status_code) { pr_notice("Status code returned 0x%08x %s\n", status_code, nt_errs[idx].nt_errstr); + return; } idx++; } -- 2.43.0
Any thoughts on the attached patch (which is tentatively in cifs-2.6.git for-next)? NT Status code is 32-bit number, so for comparing two NT Status codes is needed to check all 32 bits, and not just low 24 bits. Before this change kernel printed message: "Status code returned 0x8000002d NT_STATUS_NOT_COMMITTED" It was incorrect as because NT_STATUS_NOT_COMMITTED is defined as 0xC000002d and 0x8000002d has defined name NT_STATUS_STOPPED_ON_SYMLINK. With this change kernel prints message: "Status code returned 0x8000002d NT_STATUS_STOPPED_ON_SYMLINK" Signed-off-by: Pali Rohár <pali@kernel.org>