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: <1edc291d-6e63-89d8-d48c-443908ddc0e8@canonical.com>
Date:   Wed, 3 Jun 2020 17:15:30 +0100
From:   Colin Ian King <colin.king@...onical.com>
To:     Amir Goldstein <amir73il@...il.com>
Cc:     Miklos Szeredi <miklos@...redi.hu>,
        overlayfs <linux-unionfs@...r.kernel.org>,
        kernel-janitors@...r.kernel.org,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH][next] ovl: fix null pointer dereference on null stack
 pointer on error return

On 03/06/2020 17:11, Amir Goldstein wrote:
> On Wed, Jun 3, 2020 at 6:46 PM Colin King <colin.king@...onical.com> wrote:
>>
>> From: Colin Ian King <colin.king@...onical.com>
>>
>> There are two error return paths where the call to path_put is
>> dereferencing the null pointer 'stack'.  Fix this by avoiding the
>> error exit path via label 'out_err' that will lead to the path_put
>> calls and instead just return the error code directly.
>>
>> Addresses-Coverity: ("Dereference after null check)"
>> Fixes: 4155c10a0309 ("ovl: clean up getting lower layers")
>> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> 
> 
> Which branch is that based on?
> Doesn't seem to apply to master nor next

It was based on today's linux-next

> 
>> ---
>>  fs/overlayfs/super.c | 6 ++----
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
>> index 1094836f7e31..4be1b041b32c 100644
>> --- a/fs/overlayfs/super.c
>> +++ b/fs/overlayfs/super.c
>> @@ -1594,20 +1594,18 @@ static struct ovl_entry *ovl_get_lowerstack(struct super_block *sb,
>>         unsigned int i;
>>         struct ovl_entry *oe;
>>
>> -       err = -EINVAL;
>>         if (!ofs->config.upperdir && numlower == 1) {
>>                 pr_err("at least 2 lowerdir are needed while upperdir nonexistent\n");
>> -               goto out_err;
>> +               return ERR_PTR(-EINVAL);
>>         } else if (!ofs->config.upperdir && ofs->config.nfs_export &&
>>                    ofs->config.redirect_follow) {
>>                 pr_warn("NFS export requires \"redirect_dir=nofollow\" on non-upper mount, falling back to nfs_export=off.\n");
>>                 ofs->config.nfs_export = false;
>>         }
>>
>> -       err = -ENOMEM;
>>         stack = kcalloc(numlower, sizeof(struct path), GFP_KERNEL);
>>         if (!stack)
>> -               goto out_err;
>> +               return ERR_PTR(-ENOMEM);
>>
>>         err = -EINVAL;
>>         for (i = 0; i < numlower; i++) {
>> --
>> 2.25.1
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ