From aaeb1dea514a47e25b4dc05deb54fc4dc538d1d5 Mon Sep 17 00:00:00 2001 From: Ivan Vecera Date: Fri, 15 Feb 2019 11:23:25 +0100 Subject: [PATCH] net: sched: sch_api: set an error msg when qdisc_alloc_handle() fails This patch sets an error message in extack when the number of qdisc handles exceeds the maximum. Also the error-code ENOSPC is more appropriate than ENOMEM in this situation. Signed-off-by: Ivan Vecera Reported-by: Li Shuang Reviewed-by: Stefano Brivio Signed-off-by: David S. Miller --- net/sched/sch_api.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 2283924fb56d..b8a388e4bcc4 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c @@ -1201,9 +1201,11 @@ static struct Qdisc *qdisc_create(struct net_device *dev, } else { if (handle == 0) { handle = qdisc_alloc_handle(dev); - err = -ENOMEM; - if (handle == 0) + if (handle == 0) { + NL_SET_ERR_MSG(extack, "Maximum number of qdisc handles was exceeded"); + err = -ENOSPC; goto err_out3; + } } if (!netif_is_multiqueue(dev)) sch->flags |= TCQ_F_ONETXQUEUE; -- 2.30.2