Re: [PATCH 5.10.y] mips: sched: Fix CPUMASK_OFFSTACK memory corruption

Aaron Tomlin <[email protected]>
Newsgroups org.kernel.vger.stable
Message-ID <r762h45xpp37buhq652fie7el4uw3l6hzrxlqti6ivhsw5o2vb@5jaid5doqohi>
On Sun, Jul 26, 2026 at 08:04:55AM -0400, Sasha Levin wrote:
> > Fix this by allocating new_mask first. To handle variable-sized user
> > masks correctly, use cpumask_size() to truncate overly large user masks
> > or pad undersized masks with zeros before copying the data directly into
> > the allocated buffer.
> 
> The allocation move looks right, but the '!p' error path is off: it
> keeps "return -ESRCH;" and appends an unreachable "goto out_free_new_mask;"
> after it. Since new_mask is now allocated at the top of the function,
> that path leaks new_mask, and the trailing goto is dead code. Upstream
> (and the already-queued 5.15 backport) convert it to
> "retval = -ESRCH; goto out_free_new_mask;" instead. Could you fix that
> and resend a v2? Thanks.
> 
> -- 
> Thanks,
> Sasha

Hi Sasha,

Apologies for the delay.

I will resolve this shortly.

Kind regards,
-- 
Aaron Tomlin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.