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: <CAGG-pURhr-YkQT5xLefK0=uN7vNx_EGJob=w54Z7VzcjYb=qiA@mail.gmail.com>
Date:	Thu, 14 Nov 2013 17:58:40 -0200
From:	Geyslan Gregório Bem <geyslan@...il.com>
To:	Tyler Hicks <tyhicks@...onical.com>
Cc:	ecryptfs@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Pekka Enberg <penberg@...nel.org>
Subject: Re: [PATCH] ecryptfs: Fix explicit null dereference

2013/11/14 Tyler Hicks <tyhicks@...onical.com>:
> On 2013-11-14 15:42:14, Geyslan G. Bem wrote:
>> If the condition 'ecryptfs_file_to_private(file)' takes false branch
>> lower_file is dereferenced when NULL.
>>
>> Caught by Coverity: CIDs 1128834 and 1128833.
>>
>> Signed-off-by: Geyslan G. Bem <geyslan@...il.com>
>> ---
>
> Hello - Smatch picked up on this earlier in week and Dan analyzed the
> situation here:
>
>   http://article.gmane.org/gmane.comp.file-systems.ecryptfs.general/441
>
> I agree with his assessment and proposed the following patch:
>
>   http://article.gmane.org/gmane.comp.file-systems.ecryptfs.general/442
>
> It makes Smatch happy and it should also make Coverity happy.
>
> Tyler

True. Disregard mine.

Thanks Tyler.

>
>>  fs/ecryptfs/file.c | 12 ++++++++----
>>  1 file changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
>> index 2229a74..1c0403a 100644
>> --- a/fs/ecryptfs/file.c
>> +++ b/fs/ecryptfs/file.c
>> @@ -316,10 +316,12 @@ ecryptfs_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
>>       struct file *lower_file = NULL;
>>       long rc = -ENOTTY;
>>
>> -     if (ecryptfs_file_to_private(file))
>> -             lower_file = ecryptfs_file_to_lower(file);
>> +     if (!ecryptfs_file_to_private(file))
>> +             goto out;
>> +     lower_file = ecryptfs_file_to_lower(file);
>>       if (lower_file->f_op->unlocked_ioctl)
>>               rc = lower_file->f_op->unlocked_ioctl(lower_file, cmd, arg);
>> +out:
>>       return rc;
>>  }
>>
>> @@ -330,10 +332,12 @@ ecryptfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
>>       struct file *lower_file = NULL;
>>       long rc = -ENOIOCTLCMD;
>>
>> -     if (ecryptfs_file_to_private(file))
>> -             lower_file = ecryptfs_file_to_lower(file);
>> +     if (!ecryptfs_file_to_private(file))
>> +             goto out;
>> +     lower_file = ecryptfs_file_to_lower(file);
>>       if (lower_file->f_op && lower_file->f_op->compat_ioctl)
>>               rc = lower_file->f_op->compat_ioctl(lower_file, cmd, arg);
>> +out:
>>       return rc;
>>  }
>>  #endif
>> --
>> 1.8.4.2
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe ecryptfs" in
>> the body of a message to majordomo@...r.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
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