All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: sched: potential NULL dereference in tcf_block_find()
@ 2019-02-18  9:26 ` Dan Carpenter
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2019-02-18  9:26 UTC (permalink / raw)
  To: Jamal Hadi Salim, Vlad Buslov
  Cc: Cong Wang, Jiri Pirko, David S. Miller, netdev, kernel-janitors

The error code isn't set on this path so it would result in returning
ERR_PTR(0) and a NULL dereference in the caller.

Fixes: 18d3eefb17cf ("net: sched: refactor tcf_block_find() into standalone functions")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 net/sched/cls_api.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 266fcb34fefe..aac72b853fe9 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -1310,8 +1310,10 @@ static struct tcf_block *tcf_block_find(struct net *net, struct Qdisc **q,
 		goto errout_qdisc;
 
 	block = __tcf_block_find(net, *q, *cl, ifindex, block_index, extack);
-	if (IS_ERR(block))
+	if (IS_ERR(block)) {
+		err = PTR_ERR(block);
 		goto errout_qdisc;
+	}
 
 	return block;
 
-- 
2.17.1


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

* [PATCH net-next] net: sched: potential NULL dereference in tcf_block_find()
@ 2019-02-18  9:26 ` Dan Carpenter
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2019-02-18  9:26 UTC (permalink / raw)
  To: Jamal Hadi Salim, Vlad Buslov
  Cc: Cong Wang, Jiri Pirko, David S. Miller, netdev, kernel-janitors

The error code isn't set on this path so it would result in returning
ERR_PTR(0) and a NULL dereference in the caller.

Fixes: 18d3eefb17cf ("net: sched: refactor tcf_block_find() into standalone functions")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 net/sched/cls_api.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 266fcb34fefe..aac72b853fe9 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -1310,8 +1310,10 @@ static struct tcf_block *tcf_block_find(struct net *net, struct Qdisc **q,
 		goto errout_qdisc;
 
 	block = __tcf_block_find(net, *q, *cl, ifindex, block_index, extack);
-	if (IS_ERR(block))
+	if (IS_ERR(block)) {
+		err = PTR_ERR(block);
 		goto errout_qdisc;
+	}
 
 	return block;
 
-- 
2.17.1

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

* Re: [PATCH net-next] net: sched: potential NULL dereference in tcf_block_find()
  2019-02-18  9:26 ` Dan Carpenter
  (?)
@ 2019-02-18 12:26 ` Vlad Buslov
  -1 siblings, 0 replies; 5+ messages in thread
From: Vlad Buslov @ 2019-02-18 12:26 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jamal Hadi Salim, Cong Wang, Jiri Pirko, David S. Miller, netdev,
	kernel-janitors

On Mon 18 Feb 2019 at 09:26, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> The error code isn't set on this path so it would result in returning
> ERR_PTR(0) and a NULL dereference in the caller.
>
> Fixes: 18d3eefb17cf ("net: sched: refactor tcf_block_find() into standalone functions")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Hi Dan,

Thank you for finding and fixing this!

Regards,
Vlad

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

* Re: [PATCH net-next] net: sched: potential NULL dereference in tcf_block_find()
  2019-02-18  9:26 ` Dan Carpenter
@ 2019-02-21 21:11   ` David Miller
  -1 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2019-02-21 21:11 UTC (permalink / raw)
  To: dan.carpenter; +Cc: jhs, vladbu, xiyou.wangcong, jiri, netdev, kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Mon, 18 Feb 2019 12:26:32 +0300

> The error code isn't set on this path so it would result in returning
> ERR_PTR(0) and a NULL dereference in the caller.
> 
> Fixes: 18d3eefb17cf ("net: sched: refactor tcf_block_find() into standalone functions")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks.

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

* Re: [PATCH net-next] net: sched: potential NULL dereference in tcf_block_find()
@ 2019-02-21 21:11   ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2019-02-21 21:11 UTC (permalink / raw)
  To: dan.carpenter; +Cc: jhs, vladbu, xiyou.wangcong, jiri, netdev, kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Mon, 18 Feb 2019 12:26:32 +0300

> The error code isn't set on this path so it would result in returning
> ERR_PTR(0) and a NULL dereference in the caller.
> 
> Fixes: 18d3eefb17cf ("net: sched: refactor tcf_block_find() into standalone functions")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks.

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

end of thread, other threads:[~2019-02-21 21:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-18  9:26 [PATCH net-next] net: sched: potential NULL dereference in tcf_block_find() Dan Carpenter
2019-02-18  9:26 ` Dan Carpenter
2019-02-18 12:26 ` Vlad Buslov
2019-02-21 21:11 ` David Miller
2019-02-21 21:11   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.