mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Alex Lyashkov <shadow@psoft.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: possible kernel bug in signal transit.
Date: Sat, 13 Mar 2004 17:18:56 -0800	[thread overview]
Message-ID: <20040313171856.37b32e52.akpm@osdl.org> (raw)
In-Reply-To: <1079197336.13835.15.camel@berloga.shadowland>

Alex Lyashkov <shadow@psoft.net> wrote:
>
> Hello All
> 
> I analyze kernel vanila 2.6.4 and found one possible bug in
> __kill_pg_info function.
> 
>         for_each_task_pid(pgrp, PIDTYPE_PGID, p, l, pid) {
>                 err = group_send_sig_info(sig, info, p);
>                 if (retval)
>                         retval = err;
>         }
> but I think if (retval) is incorrect check. possible this cycle must be
>         for_each_task_pid(pgrp, PIDTYPE_PGID, p, l, pid) {
>                 err = group_send_sig_info(sig, info, p);
>                 if (ret) {
>                         retval = err;
> 			break;
> 		}
>         }
> because in original variant me assign to retval only first value from
> ret and other be ignored if this value be 0.
> 

No, the code's OK, albeit undesirably obscure.  It will return -ESRCH if
none of the tasks had a matching pgrp and will return the result of the
final non-zero-returning group_send_sig_info() if one or more of the
group_send_sig_info() calls failed, and will return zero if all of the
group_send_sig_info() calls returned zero.

Thanks for checking though..

  reply	other threads:[~2004-03-14  1:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-13 17:02 Alex Lyashkov
2004-03-14  1:18 ` Andrew Morton [this message]
2004-03-14  4:39   ` Alex Lyashkov
2004-03-14  5:00     ` Andrew Morton
2004-03-14  5:21       ` Alex Lyashkov
2004-03-14  5:47         ` Andrew Morton
2004-03-14  5:56           ` Alex Lyashkov
2004-03-14  6:09             ` Andrew Morton
2004-03-14  6:26               ` Alex Lyashkov
2004-03-14  6:37                 ` Andrew Morton

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=20040313171856.37b32e52.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shadow@psoft.net \
    /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

all inboxes | Powered by JetHome®