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]
Date:	Tue, 21 Aug 2012 06:51:58 -0700
From:	Anatol Pomozov <anatol.pomozov@...il.com>
To:	Jan Engelhardt <jengelh@...i.de>
Cc:	linux-kernel@...r.kernel.org, viro@...iv.linux.org.uk,
	tytso@....edu, Anatol Pomazau <anatol@...gle.com>
Subject: Re: [PATCH] fs: Preserve error code in get_empty_filp()

Hi

On Tue, Aug 21, 2012 at 3:06 AM, Jan Engelhardt <jengelh@...i.de> wrote:
>
>
> On Wednesday 2012-08-01 20:19, anatol.pomozov@...il.com wrote:
> >Allocating a file structure in function get_empty_filp() might fail
> > because
> >of several reasons:
> > - not enough memory for file structures
> > - operation is not allowed
> > - user is over its limit
> >
> >Currently the function returns NULL in all cases and we loose the exact
> >reason of the error. All callers of get_empty_filp() assume that the
> > function
> >can fail with ENFILE only.
> >
> >Return error through pointer. Change all callers to preserve this error
> > code.
>
> >       percpu_counter_inc(&nr_files);
> >       f->f_cred = get_cred(cred);
> >-      if (security_file_alloc(f))
> >+      if (security_file_alloc(f)) {
> >+              error = -EPERM;
> >               goto fail_sec;
> >+      }
>
> You are not preserving the error code from security_file_alloc here.
>
> In particular, apparmoar/lsm.c: file_alloc_security can return -ENOMEM,
> for example.

Yep, this was a bug in the first version of the patch. It the latest
version (from Aug 2) it is fixed, please review this version instead.
--
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