netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
To: Cong Wang <xiyou.wangcong@gmail.com>,
	Vinicius Costa Gomes <vinicius.gomes@intel.com>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>,
	intel-wired-lan <intel-wired-lan@lists.osuosl.org>,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	Jiri Pirko <jiri@resnulli.us>,
	andre.guedes@intel.com, Ivan Briano <ivan.briano@intel.com>,
	boon.leong.ong@intel.com, richardcochran@gmail.com,
	Henrik Austad <henrik@austad.us>,
	levipearson@gmail.com, rodney.cummings@ni.com
Subject: Re: [next-queue PATCH v2 2/5] net/sched: Fix accessing invalid dev_queue
Date: Mon, 2 Oct 2017 08:57:06 -0700	[thread overview]
Message-ID: <bb111622-1a5c-2a8b-f526-c94f7b77d454@intel.com> (raw)
In-Reply-To: <CAM_iQpW7YtS2=rRw814=zWcJaUOGmkWQ+NHQKPwsBF4hMQSRVg@mail.gmail.com>

Hi,

On 09/30/2017 05:22 PM, Cong Wang wrote:
> On Fri, Sep 29, 2017 at 5:26 PM, Vinicius Costa Gomes
> <vinicius.gomes@intel.com> wrote:
>> From: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
>>
>> In qdisc_alloc() the dev_queue pointer was used without any checks being
>> performed. If qdisc_create() gets a null dev_queue pointer, it just
>> passes it along to qdisc_alloc(), leading to a crash. That happens if a
>> root qdisc implements select_queue() and returns a null dev_queue
>> pointer for an "invalid handle", for example.
> 
> Does it make sense to let mqprio_select_queue() always return
> non-NULL?
> 
> At least mq_select_queue() returns queue #0 as a fallback.

I had seen that, but my understanding was that for mqprio the inner qdiscs are
always related to one of the Tx netdev_queue per design. Returning any other
queue as a fallback seemed like going against that to me.

I'd rather keep this function as the patch is proposing, thus either returning
the correct netdev_queue for a given handle, or NULL as a way to flag that
something was 'wrong' with it. Returning queue #0 is misleading in that sense, imo.

What do you think?

Regards,
Jesus

  reply	other threads:[~2017-10-02 16:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-30  0:26 [next-queue PATCH v2 0/5] TSN: Add qdisc based config interface for CBS Vinicius Costa Gomes
2017-09-30  0:26 ` [next-queue PATCH v2 1/5] mqprio: Implement select_queue class_ops Vinicius Costa Gomes
2017-09-30  0:26 ` [next-queue PATCH v2 2/5] net/sched: Fix accessing invalid dev_queue Vinicius Costa Gomes
2017-10-01  0:22   ` Cong Wang
2017-10-02 15:57     ` Jesus Sanchez-Palencia [this message]
2017-09-30  0:26 ` [next-queue PATCH v2 3/5] net/sched: Introduce the user API for the CBS shaper Vinicius Costa Gomes
2017-10-01  0:24   ` Cong Wang
2017-10-02 17:07     ` Vinicius Costa Gomes
2017-09-30  0:26 ` [next-queue PATCH v2 4/5] net/sched: Introduce Credit Based Shaper (CBS) qdisc Vinicius Costa Gomes
2017-09-30  0:26 ` [next-queue PATCH v2 5/5] igb: Add support for CBS offload Vinicius Costa Gomes

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=bb111622-1a5c-2a8b-f526-c94f7b77d454@intel.com \
    --to=jesus.sanchez-palencia@intel.com \
    --cc=andre.guedes@intel.com \
    --cc=boon.leong.ong@intel.com \
    --cc=henrik@austad.us \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=ivan.briano@intel.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=levipearson@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    --cc=rodney.cummings@ni.com \
    --cc=vinicius.gomes@intel.com \
    --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 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).