net: sched: sch_api: set an error msg when qdisc_alloc_handle() fails
authorIvan Vecera <ivecera@redhat.com>
Fri, 15 Feb 2019 10:23:25 +0000 (11:23 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 17 Feb 2019 23:39:08 +0000 (15:39 -0800)
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 <ivecera@redhat.com>
Reported-by: Li Shuang <shuali@redhat.com>
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_api.c

index 2283924fb56d57622d06691cb7f5dd13ec1e6783..b8a388e4bcc4e595a83dc5ba21d7fdef57d6e358 100644 (file)
@@ -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;