Public bug reported:

This patch fixes issues reported in
https://nvidia.atlassian.net/browse/DGX-18529

mpam_force_unknown_msc_get() prints every id in the force_unknown_msc
xarray into the PAGE_SIZE buffer sysfs passes to parameter getters. It
used sprintf() with no remaining-length check, so enough ids write past
the end of that buffer. sysfs also rejects a returned length of
PAGE_SIZE or more, so the read reports a bad count.

Format each id into a small temporary buffer and copy it only if the id,
the separator, and the trailing newline and NUL still fit. Stop when the
next id does not fit, so the getter never writes past the page and
always returns a length below PAGE_SIZE.

mpam_force_unknown_msc_set() also ignored a NULL return from kstrdup().
A failed allocation then reached kstrtou32() and dereferenced NULL.
Return -ENOMEM instead.

Fixes: b967125 ("NVIDIA: SAUCE: arm_mpam: Allow MSC to be forced to have
an unknown location")

** Affects: linux-nvidia (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2173591

Title:
  NVIDIA: SAUCE: resctrl/mpam: fix force_unknown_msc sysfs parameter

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux-nvidia/+bug/2173591/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to