public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen@asianux.com>
To: Tejun Heo <tj@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Michael Kerrisk <mtk.manpages@gmail.com>
Subject: Re: [PATCH] kernel/groups.c: consider about NULL for 'group_info' in all related extern functions
Date: Thu, 26 Sep 2013 14:30:31 +0800	[thread overview]
Message-ID: <5243D487.8000602@asianux.com> (raw)
In-Reply-To: <5243CD18.1060805@asianux.com>

On 09/26/2013 01:58 PM, Chen Gang wrote:
> On 09/25/2013 12:34 PM, Chen Gang wrote:
>> On 09/25/2013 09:47 AM, Chen Gang wrote:
>>> On 09/25/2013 09:14 AM, Tejun Heo wrote:
>>>> On Wed, Sep 25, 2013 at 09:06:52AM +0800, Chen Gang wrote:
>>>>> OK, I see, the 'root cause' is: "you are not the related maintainer
>>>>> either", so it is really necessary for me to spend additional time
>>>>> resource on it :-(.
>>>>
>>>> Yeah, at least partly.  That and the fact that I'm not too willing to
>>>> dig into the code without further evidence.  It isn't anything strange
>>>> to ask tho and I'm likely to do that even for subsystems that I know
>>>> intimately if the subject code has been stable / stale for years and
>>>> the analysis doesn't seem immediately convincing.  And, if my
>>>> experience is anything to go by, it's not too unlikely that you might
>>>> hit something which doesn't agree with your current assumptions while
>>>> trying to actually trigger the problem.
>>>>
>>>> Thanks.
>>>>
> 
> Oh, not cause issue, the reason is "'groups' exports extern variable
> 'init_groups', when start process, default 'cred' will set it to be
> sure of groups always be initialized".
> 
> Hmm... but after all, I still think this file need be improved: "remove
> the group_info checking in groups_search()", please help check, thanks.
> 
> -------------------------------patch begin------------------------------
> 
> kernel/groups.c: remove useless "!group_info" checking in groups_search().
> 
>   Since groups_free() need not check 'group_info', groups_search() need
>   not, either, and then in_group_p() and in_egroup_p(), either.
> 
> 
>   'groups' assumes kernel mode callers are sure of 'group_info' valid.
> 

Oh, need use "callers" instead of "kernel mode callers".

>   When process starts, the related kernel mode caller need set default
>   'group_info' firstly (extern variable 'init_group').
>
 
And also need append one sentence: "and the callers also need be sure
of "&init_group" is not passed to groups_free()."


>   If groups_alloc() fails, the caller must not call any related API again
>   with the related invalid 'group_info'.
> 
> 
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
>  kernel/groups.c |    3 ---
>  1 files changed, 0 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/groups.c b/kernel/groups.c
> index 90cf1c3..0a7f81d 100644
> --- a/kernel/groups.c
> +++ b/kernel/groups.c
> @@ -136,9 +136,6 @@ int groups_search(const struct group_info *group_info, kgid_t grp)
>  {
>  	unsigned int left, right;
>  
> -	if (!group_info)
> -		return 0;
> -
>  	left = 0;
>  	right = group_info->ngroups;
>  	while (left < right) {
> 


-- 
Chen Gang

-- 
Chen Gang

  reply	other threads:[~2013-09-26  6:31 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-20  3:01 [PATCH] kernel/groups.c: consider about NULL for 'group_info' in all related extern functions Chen Gang
2013-08-20  3:03 ` Chen Gang
2013-09-03  5:23   ` Chen Gang
2013-09-23 15:06 ` Tejun Heo
2013-09-24  3:42   ` Chen Gang
2013-09-24  4:06     ` Tejun Heo
2013-09-24  4:27       ` Chen Gang
2013-09-24 12:04         ` Tejun Heo
2013-09-25  0:49           ` Chen Gang
2013-09-25  0:58             ` Tejun Heo
2013-09-25  1:06               ` Chen Gang
2013-09-25  1:14                 ` Tejun Heo
2013-09-25  1:47                   ` Chen Gang
2013-09-25  4:34                     ` Chen Gang
2013-09-26  5:58                       ` Chen Gang
2013-09-26  6:30                         ` Chen Gang [this message]
2013-09-26 13:15                           ` Tejun Heo
2013-09-27  1:30                             ` Chen Gang
2013-09-27  3:36                               ` Tejun Heo
2013-09-27  7:16                                 ` Chen Gang
2013-09-27 11:53                                   ` Tejun Heo
2013-09-27 12:19                                     ` Chen Gang
2013-09-29  2:50                                       ` Chen Gang

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=5243D487.8000602@asianux.com \
    --to=gang.chen@asianux.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=tj@kernel.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