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: <CAEjxPJ59=rHFovk3scmkhLuiAdu2uinGiua60y0naJ0e95GLmg@mail.gmail.com>
Date: Tue, 6 Aug 2024 09:25:53 -0400
From: Stephen Smalley <stephen.smalley.work@...il.com>
To: thunder.leizhen@...weicloud.com
Cc: Paul Moore <paul@...l-moore.com>, Ondrej Mosnacek <omosnace@...hat.com>, selinux@...r.kernel.org, 
	linux-kernel@...r.kernel.org, Zhen Lei <thunder.leizhen@...wei.com>, 
	Nick Kralevich <nnk@...gle.com>, Jeff Vander Stoep <jeffv@...gle.com>
Subject: Re: [PATCH 1/1] selinux: Fix potential counting error in avc_add_xperms_decision()

On Tue, Aug 6, 2024 at 2:51 AM <thunder.leizhen@...weicloud.com> wrote:
>
> From: Zhen Lei <thunder.leizhen@...wei.com>
>
> The count increases only when a node is successfully added to
> the linked list.
>
> Fixes: fa1aa143ac4a ("selinux: extended permissions for ioctls")
> Signed-off-by: Zhen Lei <thunder.leizhen@...wei.com>

This looks correct to me but I also notice that the caller is not
checking or handling the return code for the -ENOMEM situation.
Acked-by: Stephen Smalley <stephen.smalley.work@...il.com>

> ---
>  security/selinux/avc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/security/selinux/avc.c b/security/selinux/avc.c
> index 32eb67fb3e42c0f..7087cd2b802d8d8 100644
> --- a/security/selinux/avc.c
> +++ b/security/selinux/avc.c
> @@ -330,12 +330,12 @@ static int avc_add_xperms_decision(struct avc_node *node,
>  {
>         struct avc_xperms_decision_node *dest_xpd;
>
> -       node->ae.xp_node->xp.len++;
>         dest_xpd = avc_xperms_decision_alloc(src->used);
>         if (!dest_xpd)
>                 return -ENOMEM;
>         avc_copy_xperms_decision(&dest_xpd->xpd, src);
>         list_add(&dest_xpd->xpd_list, &node->ae.xp_node->xpd_head);
> +       node->ae.xp_node->xp.len++;
>         return 0;
>  }
>
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ