Re: [PATCH] mm: don't allow empty relative nodemask in mpol_relative_nodemask()

From: David Hildenbrand (Arm)

Date: Mon Jun 01 2026 - 10:14:26 EST


On 5/28/26 21:03, Yury Norov wrote:
> Reassigning nodes relative an empty user-provided nodemask is useless,
> and triggers divide-by-zero in the function.
>
> Reported-by: Farhad Alemi <farhad.alemi@xxxxxxxxxxxx>
> Link: https://lore.kernel.org/all/CA+0ovCgxbZkXa+OU8w3s84R3KNPNxxRfmsNR-udh+afQBbGNmw@xxxxxxxxxxxxxx/

Likely this should be a

Closes:

And be accompanied by a Fixes: and Cc stable.

> Signed-off-by: Yury Norov <ynorov@xxxxxxxxxx>
> ---
> mm/mempolicy.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/mm/mempolicy.c b/mm/mempolicy.c
> index 4e4421b22b59..cd961fa1eb33 100644
> --- a/mm/mempolicy.c
> +++ b/mm/mempolicy.c
> @@ -370,8 +370,13 @@ static inline int mpol_store_user_nodemask(const struct mempolicy *pol)
> static void mpol_relative_nodemask(nodemask_t *ret, const nodemask_t *orig,
> const nodemask_t *rel)
> {


Continuing the discussion of the context in the other thread :)


--
Cheers,

David