From: Anatol Pomozov <anatol.pomozov@gmail.com>
To: Jan Engelhardt <jengelh@inai.de>
Cc: linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk,
tytso@mit.edu, Anatol Pomazau <anatol@google.com>
Subject: Re: [PATCH] fs: Preserve error code in get_empty_filp()
Date: Tue, 21 Aug 2012 06:51:58 -0700 [thread overview]
Message-ID: <CAOMFOmW1XZrgHHp+b6s9xjn1iYNqA1ej1KpiyO=KMeCsRgRTzg@mail.gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.01.1208211204420.1100@frira.zrqbmnf.qr>
Hi
On Tue, Aug 21, 2012 at 3:06 AM, Jan Engelhardt <jengelh@inai.de> wrote:
>
>
> On Wednesday 2012-08-01 20:19, anatol.pomozov@gmail.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.
next prev parent reply other threads:[~2012-08-21 13:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-01 18:19 [PATCH] fs: Preserve error code in get_empty_filp() anatol.pomozov
2012-08-01 18:34 ` anatol.pomozov
2012-08-03 0:30 ` Anatol Pomozov
2012-08-03 0:47 ` Anatol Pomozov
2012-09-04 21:15 ` Anatol Pomozov
2012-08-21 10:06 ` Jan Engelhardt
2012-08-21 13:51 ` Anatol Pomozov [this message]
2012-09-13 3:11 Anatol Pomozov
2012-10-05 18:16 ` Anatol Pomozov
2012-10-05 18:39 ` Theodore Ts'o
2013-02-15 2:21 ` Al Viro
2013-02-21 16:36 ` Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAOMFOmW1XZrgHHp+b6s9xjn1iYNqA1ej1KpiyO=KMeCsRgRTzg@mail.gmail.com' \
--to=anatol.pomozov@gmail.com \
--cc=anatol@google.com \
--cc=jengelh@inai.de \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).