lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKXHbyONc4FqCaKhm7KmLfdwKfgtWD4nBhqPsEHUKvx0CFGBRw@mail.gmail.com>
Date:	Thu, 29 Jan 2015 20:47:21 +0100
From:	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
To:	Frank Zago <fzago@...y.com>
Cc:	Oleg Drokin <oleg.drokin@...el.com>,
	Andreas Dilger <andreas.dilger@...el.com>,
	"HPDD-discuss@...ts.01.org" <HPDD-discuss@...ts.01.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [HPDD-discuss] [PATCH] staging: lustre: include: lustre_update.h:
 Fix for possible null pointer dereference

2015-01-29 20:40 GMT+01:00 Frank Zago <fzago@...y.com>:
> On 01/29/2015 12:47 PM, Rickard Strandqvist wrote:
>>
>> Fix a possible null pointer dereference, there is
>> otherwise a risk of a possible null pointer dereference.
>>
>> This was found using a static code analysis program called cppcheck
>>
>> Signed-off-by: Rickard Strandqvist
>> <rickard_strandqvist@...ctrumdigital.se>
>> ---
>>   drivers/staging/lustre/lustre/include/lustre_update.h |    4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/lustre/lustre/include/lustre_update.h
>> b/drivers/staging/lustre/lustre/include/lustre_update.h
>> index 84defce..00e1361 100644
>> --- a/drivers/staging/lustre/lustre/include/lustre_update.h
>> +++ b/drivers/staging/lustre/lustre/include/lustre_update.h
>> @@ -165,12 +165,14 @@ static inline int update_get_reply_buf(struct
>> update_reply *reply, void **buf,
>>         int  result;
>>
>>         ptr = update_get_buf_internal(reply, index, &size);
>> +
>> +       LASSERT((ptr != NULL && size >= sizeof(int)));
>
>
> Now size is tested before result. So it could assert if result < 0, while
> the function would have returned before.
>
>
>> +
>>         result = *(int *)ptr;
>>
>>         if (result < 0)
>>                 return result;
>>
>> -       LASSERT((ptr != NULL && size >= sizeof(int)));
>>         *buf = ptr + sizeof(int);
>>         return size - sizeof(int);
>>   }
>>
>



But if prt is null krachar on the line:
result = *(int *)ptr;

Maybe there should be two LASSERT then.

Kind regards
Rickard Strandqvist
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ