netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: sched: return error code when tcf proto is not found
@ 2018-06-04 15:32 Vlad Buslov
  2018-06-04 21:32 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Vlad Buslov @ 2018-06-04 15:32 UTC (permalink / raw)
  To: netdev; +Cc: davem, jhs, xiyou.wangcong, jiri, dan.carpenter, Vlad Buslov

If requested tcf proto is not found, get and del filter netlink protocol
handlers output error message to extack, but do not return actual error
code. Add check to return ENOENT when result of tp find function is NULL
pointer.

Fixes: c431f89b18a2 ("net: sched: split tc_ctl_tfilter into three
handlers")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Vlad Buslov <vladbu@mellanox.com>

---
 net/sched/cls_api.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index c06585fb2dc6..cdc3c87c53e6 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -1274,7 +1274,7 @@ static int tc_del_tfilter(struct sk_buff *skb, struct nlmsghdr *n,
 			       prio, false);
 	if (!tp || IS_ERR(tp)) {
 		NL_SET_ERR_MSG(extack, "Filter with specified priority/protocol not found");
-		err = PTR_ERR(tp);
+		err = tp ? PTR_ERR(tp) : -ENOENT;
 		goto errout;
 	} else if (tca[TCA_KIND] && nla_strcmp(tca[TCA_KIND], tp->ops->kind)) {
 		NL_SET_ERR_MSG(extack, "Specified filter kind does not match existing one");
@@ -1374,7 +1374,7 @@ static int tc_get_tfilter(struct sk_buff *skb, struct nlmsghdr *n,
 			       prio, false);
 	if (!tp || IS_ERR(tp)) {
 		NL_SET_ERR_MSG(extack, "Filter with specified priority/protocol not found");
-		err = PTR_ERR(tp);
+		err = tp ? PTR_ERR(tp) : -ENOENT;
 		goto errout;
 	} else if (tca[TCA_KIND] && nla_strcmp(tca[TCA_KIND], tp->ops->kind)) {
 		NL_SET_ERR_MSG(extack, "Specified filter kind does not match existing one");
-- 
2.7.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: sched: return error code when tcf proto is not found
  2018-06-04 15:32 [PATCH net-next] net: sched: return error code when tcf proto is not found Vlad Buslov
@ 2018-06-04 21:32 ` David Miller
  2018-06-05  7:00   ` Vlad Buslov
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2018-06-04 21:32 UTC (permalink / raw)
  To: vladbu; +Cc: netdev, jhs, xiyou.wangcong, jiri, dan.carpenter

From: Vlad Buslov <vladbu@mellanox.com>
Date: Mon,  4 Jun 2018 18:32:23 +0300

> If requested tcf proto is not found, get and del filter netlink protocol
> handlers output error message to extack, but do not return actual error
> code. Add check to return ENOENT when result of tp find function is NULL
> pointer.
> 
> Fixes: c431f89b18a2 ("net: sched: split tc_ctl_tfilter into three
> handlers")

Please do not split up a Fixes: tag into multiple lines.  I fixed it
up for you this time.

> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Vlad Buslov <vladbu@mellanox.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: sched: return error code when tcf proto is not found
  2018-06-04 21:32 ` David Miller
@ 2018-06-05  7:00   ` Vlad Buslov
  0 siblings, 0 replies; 3+ messages in thread
From: Vlad Buslov @ 2018-06-05  7:00 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, jhs, xiyou.wangcong, jiri, dan.carpenter


On Mon 04 Jun 2018 at 21:32, David Miller <davem@davemloft.net> wrote:
> From: Vlad Buslov <vladbu@mellanox.com>
> Date: Mon,  4 Jun 2018 18:32:23 +0300
>
>> If requested tcf proto is not found, get and del filter netlink protocol
>> handlers output error message to extack, but do not return actual error
>> code. Add check to return ENOENT when result of tp find function is NULL
>> pointer.
>> 
>> Fixes: c431f89b18a2 ("net: sched: split tc_ctl_tfilter into three
>> handlers")
>
> Please do not split up a Fixes: tag into multiple lines.  I fixed it
> up for you this time.

Got it, thanks.

>
>> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>> Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
>
> Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-05  7:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-04 15:32 [PATCH net-next] net: sched: return error code when tcf proto is not found Vlad Buslov
2018-06-04 21:32 ` David Miller
2018-06-05  7:00   ` Vlad Buslov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).