Skip to contentSkip to conversation

net: sched: sch_api: set an error msg when qdisc_alloc_handle() fails

PATCH Applied Ivan Vecera 3 participants 3 messages Feb 15, 2019 – Feb 17, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 net/sched/sch_api.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
net/sched/sch_api.c +4 -2
index 2283924fb56d..b8a388e4bcc4 100644
@@ -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;
Signature · 1 line
2.19.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · On Fri, 15 Feb 2019 11:23:25 +0100 Ivan Vecera <[email protected]> wrote:

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.

Quoted 1 line
Signature · 1 line
Stefano