netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net/sched: fix refcnt leak in the error path of tcf_vlan_init()
@ 2018-05-16 10:54 Davide Caratti
  2018-05-16 11:45 ` Jamal Hadi Salim
  2018-05-16 18:42 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Davide Caratti @ 2018-05-16 10:54 UTC (permalink / raw)
  To: David S. Miller, netdev, Jiri Pirko; +Cc: Jamal Hadi Salim, Roman Mashak

Similarly to what was done with commit a52956dfc503 ("net sched actions:
fix refcnt leak in skbmod"), fix the error path of tcf_vlan_init() to avoid
refcnt leaks when wrong value of TCA_VLAN_PUSH_VLAN_PROTOCOL is given.

Fixes: 5026c9b1bafc ("net sched: vlan action fix late binding")
CC: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
---
 net/sched/act_vlan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c
index 853604685965..1fb39e1f9d07 100644
--- a/net/sched/act_vlan.c
+++ b/net/sched/act_vlan.c
@@ -161,6 +161,8 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla,
 			case htons(ETH_P_8021AD):
 				break;
 			default:
+				if (exists)
+					tcf_idr_release(*a, bind);
 				return -EPROTONOSUPPORT;
 			}
 		} else {
-- 
2.17.0

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

* Re: [PATCH net] net/sched: fix refcnt leak in the error path of tcf_vlan_init()
  2018-05-16 10:54 [PATCH net] net/sched: fix refcnt leak in the error path of tcf_vlan_init() Davide Caratti
@ 2018-05-16 11:45 ` Jamal Hadi Salim
  2018-05-16 18:42 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Jamal Hadi Salim @ 2018-05-16 11:45 UTC (permalink / raw)
  To: Davide Caratti, David S. Miller, netdev, Jiri Pirko; +Cc: Roman Mashak

On 16/05/18 06:54 AM, Davide Caratti wrote:
> Similarly to what was done with commit a52956dfc503 ("net sched actions:
> fix refcnt leak in skbmod"), fix the error path of tcf_vlan_init() to avoid
> refcnt leaks when wrong value of TCA_VLAN_PUSH_VLAN_PROTOCOL is given.
> 
> Fixes: 5026c9b1bafc ("net sched: vlan action fix late binding")
> CC: Roman Mashak <mrv@mojatatu.com>
> Signed-off-by: Davide Caratti <dcaratti@redhat.com>
> ---
>   net/sched/act_vlan.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c
> index 853604685965..1fb39e1f9d07 100644
> --- a/net/sched/act_vlan.c
> +++ b/net/sched/act_vlan.c
> @@ -161,6 +161,8 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla,
>   			case htons(ETH_P_8021AD):
>   				break;
>   			default:
> +				if (exists)
> +					tcf_idr_release(*a, bind);
>   				return -EPROTONOSUPPORT;

LGTM.
Note: 5026c9b1bafc fixed the bug that existed. It missed a few
spots like the one here. If there was an "Updates" tag, it would
be more appropriate.

Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>

cheers,
jamal

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

* Re: [PATCH net] net/sched: fix refcnt leak in the error path of tcf_vlan_init()
  2018-05-16 10:54 [PATCH net] net/sched: fix refcnt leak in the error path of tcf_vlan_init() Davide Caratti
  2018-05-16 11:45 ` Jamal Hadi Salim
@ 2018-05-16 18:42 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-05-16 18:42 UTC (permalink / raw)
  To: dcaratti; +Cc: netdev, jiri, jhs, mrv

From: Davide Caratti <dcaratti@redhat.com>
Date: Wed, 16 May 2018 12:54:29 +0200

> Similarly to what was done with commit a52956dfc503 ("net sched actions:
> fix refcnt leak in skbmod"), fix the error path of tcf_vlan_init() to avoid
> refcnt leaks when wrong value of TCA_VLAN_PUSH_VLAN_PROTOCOL is given.
> 
> Fixes: 5026c9b1bafc ("net sched: vlan action fix late binding")
> CC: Roman Mashak <mrv@mojatatu.com>
> Signed-off-by: Davide Caratti <dcaratti@redhat.com>

Applied and queued up for -stable, thanks.

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

end of thread, other threads:[~2018-05-16 18:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-16 10:54 [PATCH net] net/sched: fix refcnt leak in the error path of tcf_vlan_init() Davide Caratti
2018-05-16 11:45 ` Jamal Hadi Salim
2018-05-16 18:42 ` David Miller

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).