[apparmor] [patch 2/2] fix: parser: close of fd with value of -1
Steve Beattie
steve at nxnw.org
Sat Oct 25 20:22:13 UTC 2014
On Sat, Oct 25, 2014 at 04:15:19PM -0400, john.johansen at canonical.com wrote:
> Both valgrind and strace report the parser doing
> close(-1) = -1 EBADF (Bad file descriptor)
>
> This happens the skip kernel load argument is specified in combination
> with any of --add, --replace, or --remove arguments (the default
> is --add if no other option is specified).
>
> This happens when the parser is not processing profiles but not
> writing them out (eg. no kernel load, dump to stdout, file ...)
>
> Signed-off-by: John Johansen <john.johansen at canonical.com>
Acked-by: Steve Beattie <steve at nxnw.org>
Thanks!
> ---
> parser/parser_interface.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> --- 3.0-diff.orig/parser/parser_interface.c
> +++ 3.0-diff/parser/parser_interface.c
> @@ -597,7 +597,8 @@
> }
> }
>
> - close(fd);
> + if (fd != -1)
> + close(fd);
>
> if (!prof->hat_table.empty() && option != OPTION_REMOVE) {
> if (load_flattened_hats(prof, option) == 0)
>
>
--
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20141025/1857b0d2/attachment.pgp>
More information about the AppArmor
mailing list