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 <ivec...@redhat.com>
---
 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.19.2

Reply via email to