[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <AANLkTimFk8SDn3RpxDVacZXOS3uwnT-qz+P7GEp+Fjjn@mail.gmail.com>
Date: Sat, 4 Dec 2010 16:55:47 +0800
From: Changli Gao <xiaosuo@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Tom Herbert <therbert@...gle.com>,
Jiri Pirko <jpirko@...hat.com>, netdev@...r.kernel.org
Subject: Re: [PATCH] net: init ingress queue
On Sat, Dec 4, 2010 at 4:47 PM, Eric Dumazet <eric.dumazet@...il.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@...il.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@...il.com)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists