From: Eric Dumazet edumazet@google.com
mainline inclusion from mainline-v5.9-rc1 commit 2e0d8fef5f76bce0887c73b824d9e625a08e7406 category: bugfix bugzilla: 45956 CVE: NA
--------------------------------
We must accept an empty mask in store_rps_map(), or we are not able to disable RPS on a queue.
Fixes: 07bbecb34106 ("net: Restrict receive packets queuing to housekeeping CPUs") Signed-off-by: Eric Dumazet edumazet@google.com Reported-by: Maciej ĺ‘•enczykowski maze@google.com Cc: Alex Belits abelits@marvell.com Cc: Nitesh Narayan Lal nitesh@redhat.com Cc: Peter Zijlstra (Intel) peterz@infradead.org Reviewed-by: Maciej ĺ‘•enczykowski maze@google.com Acked-by: Peter Zijlstra (Intel) peterz@infradead.org Acked-by: Nitesh Narayan Lal nitesh@redhat.com Signed-off-by: David S. Miller davem@davemloft.net Signed-off-by: Liu Chao liuchao173@huawei.com Reviewed-by: Jian Cheng cj.chengjian@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- net/core/net-sysfs.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 5dd2da0ea7c6..905d9ea76660 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -736,11 +736,13 @@ static ssize_t store_rps_map(struct netdev_rx_queue *queue, return err; }
- hk_flags = HK_FLAG_DOMAIN | HK_FLAG_WQ; - cpumask_and(mask, mask, housekeeping_cpumask(hk_flags)); - if (cpumask_empty(mask)) { - free_cpumask_var(mask); - return -EINVAL; + if (!cpumask_empty(mask)) { + hk_flags = HK_FLAG_DOMAIN | HK_FLAG_WQ; + cpumask_and(mask, mask, housekeeping_cpumask(hk_flags)); + if (cpumask_empty(mask)) { + free_cpumask_var(mask); + return -EINVAL; + } }
map = kzalloc(max_t(unsigned int,