[lttng-dev] [PATCH lttng-ust] Fix: Initialize fd field of struct lttng_ust_elf to -1 at allocation

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Tue Jan 22 16:51:43 EST 2019


It slipped through. I'll merge it right away.

Thanks for the reminder!

Mathieu

----- On Jan 22, 2019, at 10:41 AM, Jonathan Rajotte jonathan.rajotte-julien at efficios.com wrote:

> Hi Mathieu,
> 
> Any feedback regarding this patch?
> 
> Cheers
> 
> On Wed, Nov 14, 2018 at 02:38:37PM -0500, Jonathan Rajotte wrote:
>> In rare cases when the executable cannot be open, using a default value
>> of zero lead to invalid close call and fd tracker removal.
>> 
>> fixes #1171
>> 
>> Reported-by: Stefan Palade <stefan.palade at windriver.com>
>> Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
>> ---
>>  liblttng-ust/lttng-ust-elf.c | 2 ++
>>  1 file changed, 2 insertions(+)
>> 
>> diff --git a/liblttng-ust/lttng-ust-elf.c b/liblttng-ust/lttng-ust-elf.c
>> index c073e7a5..3d6a9379 100644
>> --- a/liblttng-ust/lttng-ust-elf.c
>> +++ b/liblttng-ust/lttng-ust-elf.c
>> @@ -250,6 +250,8 @@ struct lttng_ust_elf *lttng_ust_elf_create(const char *path)
>>  		goto error;
>>  	}
>>  
>> +	/* Initialize fd field to -1. 0 is a valid fd number */
>> +	elf->fd = -1;
>>  
>>  	elf->path = strdup(path);
>>  	if (!elf->path) {
>> --
>> 2.17.1
>> 
> 
> --
> Jonathan Rajotte-Julien
> EfficiOS

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com


More information about the lttng-dev mailing list