# CVE-2022-48847: watch_queue: Fix filter limit check

- Severity: High 7.8 (CVSS:3.1, scored by Linux) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.24%, higher than 16% of CVEs (2026-12-01)
- Published: 2024-07-16T12:25:15.804Z
- Modified: 2026-08-05T08:52:37.538Z
- Weaknesses: CWE-787
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: Linux

## Description

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

watch_queue: Fix filter limit check

In watch_queue_set_filter(), there are a couple of places where we check
that the filter type value does not exceed what the type_filter bitmap
can hold.  One place calculates the number of bits by:

   if (tf[i].type >= sizeof(wfilter->type_filter) * 8)

which is fine, but the second does:

   if (tf[i].type >= sizeof(wfilter->type_filter) * BITS_PER_LONG)

which is not.  This can lead to a couple of out-of-bounds writes due to
a too-large type:

 (1) __set_bit() on wfilter->type_filter
 (2) Writing more elements in wfilter->filters[] than we allocated.

Fix this by just using the proper WATCH_TYPE__NR instead, which is the
number of types we actually know about.

The bug may cause an oops looking something like:

  BUG: KASAN: slab-out-of-bounds in watch_queue_set_filter+0x659/0x740
  Write of size 4 at addr ffff88800d2c66bc by task watch_queue_oob/611
  ...
  Call Trace:
   <TASK>
   dump_stack_lvl+0x45/0x59
   print_address_description.constprop.0+0x1f/0x150
   ...
   kasan_report.cold+0x7f/0x11b
   ...
   watch_queue_set_filter+0x659/0x740
   ...
   __x64_sys_ioctl+0x127/0x190
   do_syscall_64+0x43/0x90
   entry_SYSCALL_64_after_hwframe+0x44/0xae

  Allocated by task 611:
   kasan_save_stack+0x1e/0x40
   __kasan_kmalloc+0x81/0xa0
   watch_queue_set_filter+0x23a/0x740
   __x64_sys_ioctl+0x127/0x190
   do_syscall_64+0x43/0x90
   entry_SYSCALL_64_after_hwframe+0x44/0xae

  The buggy address belongs to the object at ffff88800d2c66a0
   which belongs to the cache kmalloc-32 of size 32
  The buggy address is located 28 bytes inside of
   32-byte region [ffff88800d2c66a0, ffff88800d2c66c0)

(As written by CVE List.)

## Affected

- Linux Linux: from c73be61cede5882f9605a852414db559c0ebedfd before 648895da69ced90ca770fd941c3d9479a9d72c16; from c73be61cede5882f9605a852414db559c0ebedfd before 1b09f28f70a5046acd64138075ae3f095238b045; from c73be61cede5882f9605a852414db559c0ebedfd before b36588ebbcef74583824c08352e75838d6fb4ff2; from c73be61cede5882f9605a852414db559c0ebedfd before c993ee0f9f81caf5767a50d1faeba39a0dc82af2; 5.8 (not affected: before 5.8; from 5.10.106 up to 5.10.*; from 5.15.29 up to 5.15.*; from 5.16.15 up to 5.16.*; from 5.17 up to *)
- linux linux_kernel: from 5.8 before 5.10.106; from 5.11 before 5.15.29; from 5.16 before 5.16.15

## Every score

- Linux: CVSS:3.1 7.8 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- NVD: CVSS:3.1 7.8 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`

## References

- <https://git.kernel.org/stable/c/648895da69ced90ca770fd941c3d9479a9d72c16> (patch)
- <https://git.kernel.org/stable/c/1b09f28f70a5046acd64138075ae3f095238b045> (patch)
- <https://git.kernel.org/stable/c/b36588ebbcef74583824c08352e75838d6fb4ff2> (patch)
- <https://git.kernel.org/stable/c/c993ee0f9f81caf5767a50d1faeba39a0dc82af2> (patch)

## Sources

- CVE List: [CVE-2022-48847](https://www.cve.org/CVERecord?id=CVE-2022-48847), CVE Terms of Use, modified 2026-08-05
- NVD: [CVE-2022-48847](https://nvd.nist.gov/vuln/detail/CVE-2022-48847), Public domain, modified 2026-08-04

---

Page: https://cve.day/CVE-2022-48847 · Whole record: https://cve.day/CVE-2022-48847.json · Rebuilt by cve.day 2026-11-25T22:58:19.915Z
