From: shenghui <crosslonelyover@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
Greg KH <greg@kroah.com>,
linux-mm@kvack.org, mingo@elte.hu
Subject: Re: [PATCH] avoid return NULL on root rb_node in rb_next/rb_prev in lib/rbtree.c
Date: Tue, 29 Jun 2010 14:34:48 +0800 [thread overview]
Message-ID: <AANLkTin8xnr1Vp1lXiOpWcMLHSlbwpPiRrkzZVMChOus@mail.gmail.com> (raw)
In-Reply-To: <AANLkTinuas0MPFvZk9nOd91PuHXtaluHkkcWjGKYPZOl@mail.gmail.com>
2010/6/29 shenghui <crosslonelyover@gmail.com>:
> 2010/6/28 Peter Zijlstra <peterz@infradead.org>:
>> So if ->rb_leftmost is NULL, then the if (!left) check in
>> __pick_next_entity() would return null.
>>
>> As to the NULL deref in in pick_next_task_fair()->set_next_entity() that
>> should never happen because pick_next_task_fair() will bail
>> on !->nr_running.
>>
>> Furthermore, you've failed to mention what kernel version you're looking
>> at.
>>
>
> The kernel version is 2.6.35-rc3, and 2.6.34 has the same code.
>
> For nr->running, if current is the only process in the run queue, then
> nr->running would not be zero.
> 1784 if (!cfs_rq->nr_running)
> 1785 return NULL;
> pick_next_task_fair() could pass above check and run to following:
> 1787 do {
> 1788 se = pick_next_entity(cfs_rq);
> 1789 set_next_entity(cfs_rq, se);
> 1790 cfs_rq = group_cfs_rq(se);
> 1791 } while (cfs_rq);
>
> Then pick_next_entity will get NULL for current is the root rb_node.
> Then set_next_entity would fail on NULL deference.
>
Sorry, I misunderstood the code. I'll put forward one new patch to
avoid the NULL condition
--
Thanks and Best Regards,
shenghui
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2010-06-29 6:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-28 13:17 [PATCH] avoid return NULL on root rb_node in rb_next/rb_prev in lib/rbtree.c shenghui
2010-06-28 13:55 ` Peter Zijlstra
2010-06-28 23:48 ` shenghui
2010-06-29 6:34 ` shenghui [this message]
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=AANLkTin8xnr1Vp1lXiOpWcMLHSlbwpPiRrkzZVMChOus@mail.gmail.com \
--to=crosslonelyover@gmail.com \
--cc=greg@kroah.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
/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).