[libcamera-devel] [PATCH 1/3] libcamera: process: fix killing innocent processes unexpectedly
Kieran Bingham
kieran.bingham at ideasonboard.com
Mon Jul 27 11:30:19 CEST 2020
Hi You-Sheng,
On 26/07/2020 23:42, Laurent Pinchart wrote:
> Hi You-Shang,
>
> Thank you for the patch.
>
> On Sat, Jul 25, 2020 at 08:24:40PM +0800, You-Sheng Yang wrote:
>> When a libcamera::process is being destructed or called kill() without a
>> previous successful call to start(), it's pid_ may remains -1, which
>> causes all the killable processes being killed when passed to
>> `kill(pid_, SIG_KILL)`.
>
> Oops. This is embarassing :-)
Ouch ouch ouch!
>> Signed-off-by: You-Sheng Yang <vicamo.yang at canonical.com>
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
>
>> ---
>> src/libcamera/process.cpp | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/libcamera/process.cpp b/src/libcamera/process.cpp
>> index e816ee8..8311d27 100644
>> --- a/src/libcamera/process.cpp
>> +++ b/src/libcamera/process.cpp
>> @@ -373,7 +373,8 @@ void Process::died(int wstatus)
>> */
>> void Process::kill()
>> {
>> - ::kill(pid_, SIGKILL);
>> + if (pid_ > 0)
>> + ::kill(pid_, SIGKILL);
>> }
>>
>> } /* namespace libcamera */
>
--
Regards
--
Kieran
More information about the libcamera-devel
mailing list