From: Ivan Vecera Date: Fri, 15 Feb 2019 10:23:25 +0000 (+0100) Subject: net: sched: sch_api: set an error msg when qdisc_alloc_handle() fails X-Git-Tag: v5.15~6918^2~181 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aaeb1dea514a47e25b4dc05deb54fc4dc538d1d5;p=platform%2Fkernel%2Flinux-starfive.git 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 --- diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 2283924..b8a388e 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;