netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Changli Gao <xiaosuo@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Tom Herbert <therbert@google.com>, Jiri Pirko <jpirko@redhat.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH] net: init ingress queue
Date: Sat, 4 Dec 2010 16:55:47 +0800	[thread overview]
Message-ID: <AANLkTimFk8SDn3RpxDVacZXOS3uwnT-qz+P7GEp+Fjjn@mail.gmail.com> (raw)
In-Reply-To: <1291452427.2806.90.camel@edumazet-laptop>

On Sat, Dec 4, 2010 at 4:47 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Le samedi 04 décembre 2010 à 13:45 +0800, Changli Gao a écrit :
>> The dev field of ingress queue is forgot to initialized, then NULL
>> pointer dereference happens in qdisc_alloc().
>
> < deleted oops >
>
>> Signed-off-by: Changli Gao <xiaosuo@gmail.com>
>> ---
>>  net/core/dev.c |    2 ++
>>  1 file changed, 2 insertions(+)
>> diff --git a/net/core/dev.c b/net/core/dev.c
>> index cd24374..8083c68 100644
>> --- a/net/core/dev.c
>> +++ b/net/core/dev.c
>> @@ -5577,6 +5577,8 @@ struct netdev_queue *dev_ingress_queue_create(struct net_device *dev)
>>       queue = kzalloc(sizeof(*queue), GFP_KERNEL);
>>       if (!queue)
>>               return NULL;
>> +     netdev_queue_numa_node_write(queue, -1);
>> +     queue->dev = dev;
>>       netdev_init_one_queue(dev, queue, NULL);
>>       queue->qdisc = &noop_qdisc;
>>       queue->qdisc_sleeping = &noop_qdisc;
>
> Hi Changli, thanks for bug report and patch.
>
> IMHO there is no point to include this long Oops report in Changelog for
> a net-next-2.6 temporary problem, there wont be any bugzilla report.
>

OK, Thanks.

> Instead, you could say it is a followup patch for commits 1d24eb4815d1e0
> and f2cd2d3e9b3ef960. Two or three lines with relevant information.
>
> I suggest you submit following patch instead, as this seems cleaner to
> me ?
>
> (factorize the two inits in netdev_init_one_queue())
>
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index cd24374..36e10b4 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -5113,7 +5113,6 @@ static int netif_alloc_netdev_queues(struct net_device *dev)
>  {
>        unsigned int count = dev->num_tx_queues;
>        struct netdev_queue *tx;
> -       int i;
>
>        BUG_ON(count < 1);
>
> @@ -5125,10 +5124,6 @@ static int netif_alloc_netdev_queues(struct net_device *dev)
>        }
>        dev->_tx = tx;
>
> -       for (i = 0; i < count; i++) {
> -               netdev_queue_numa_node_write(&tx[i], -1);
> -               tx[i].dev = dev;
> -       }
>        return 0;
>  }
>
> @@ -5140,6 +5135,8 @@ static void netdev_init_one_queue(struct net_device *dev,
>        spin_lock_init(&queue->_xmit_lock);
>        netdev_set_xmit_lockdep_class(&queue->_xmit_lock, dev->type);
>        queue->xmit_lock_owner = -1;
> +       netdev_queue_numa_node_write(queue, -1);
> +       queue->dev = dev;
>  }
>
>  static void netdev_init_queues(struct net_device *dev)
>
>
>

I thought about it before submitting. I am not sure if there are some
users of txq->dev before netdev_init_one_queue().

-- 
Regards,
Changli Gao(xiaosuo@gmail.com)

  reply	other threads:[~2010-12-04  8:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-04  5:45 [PATCH] net: init ingress queue Changli Gao
2010-12-04  8:47 ` Eric Dumazet
2010-12-04  8:55   ` Changli Gao [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-12-04 12:31 Changli Gao
2010-12-04 13:36 ` Jarek Poplawski
2010-12-05 21:05 ` Eric Dumazet

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=AANLkTimFk8SDn3RpxDVacZXOS3uwnT-qz+P7GEp+Fjjn@mail.gmail.com \
    --to=xiaosuo@gmail.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=jpirko@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=therbert@google.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).