All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Jiri Pirko <jiri@resnulli.us>
Cc: netdev@vger.kernel.org, davem@davemloft.net, jhs@mojatatu.com,
	xiyou.wangcong@gmail.com, mlxsw@mellanox.com, jaster@redhat.com,
	ivecera@redhat.com
Subject: Re: [patch net] net: sched: cbq: create block for q->link.block
Date: Mon, 27 Nov 2017 15:30:43 -0200	[thread overview]
Message-ID: <20171127173043.GA3472@localhost.localdomain> (raw)
In-Reply-To: <20171127172259.1183-1-jiri@resnulli.us>

On Mon, Nov 27, 2017 at 06:22:59PM +0100, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@mellanox.com>
> 
> q->link.block is not initialized, that leads to EINVAL when one tries to
> add filter there. So initialize it properly.
> 
> This can be reproduced by:

By...? :-)

> 
> Reported-by: Jaroslav Aster <jaster@redhat.com>
> Reported-by: Ivan Vecera <ivecera@redhat.com>
> Fixes: 6529eaba33f0 ("net: sched: introduce tcf block infractructure")
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> ---
>  net/sched/sch_cbq.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
> index 6361be7..525eb3a 100644
> --- a/net/sched/sch_cbq.c
> +++ b/net/sched/sch_cbq.c
> @@ -1158,9 +1158,13 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt)
>  	if ((q->link.R_tab = qdisc_get_rtab(r, tb[TCA_CBQ_RTAB])) == NULL)
>  		return -EINVAL;
>  
> +	err = tcf_block_get(&q->link.block, &q->link.filter_list, sch);
> +	if (err)
> +		goto put_rtab;
> +
>  	err = qdisc_class_hash_init(&q->clhash);
>  	if (err < 0)
> -		goto put_rtab;
> +		goto put_block;
>  
>  	q->link.sibling = &q->link;
>  	q->link.common.classid = sch->handle;
> @@ -1194,6 +1198,9 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt)
>  	cbq_addprio(q, &q->link);
>  	return 0;
>  
> +put_block:
> +	tcf_block_put(q->link.block);
> +
>  put_rtab:
>  	qdisc_put_rtab(q->link.R_tab);
>  	return err;
> -- 
> 2.9.5
> 

  reply	other threads:[~2017-11-27 17:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-27 17:22 [patch net] net: sched: cbq: create block for q->link.block Jiri Pirko
2017-11-27 17:30 ` Marcelo Ricardo Leitner [this message]
2017-11-27 17:35   ` Jiri Pirko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171127173043.GA3472@localhost.localdomain \
    --to=marcelo.leitner@gmail.com \
    --cc=davem@davemloft.net \
    --cc=ivecera@redhat.com \
    --cc=jaster@redhat.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.