Re: [PATCH RFC 5/6] selinux: unify OOM handling in network hashtables

From: Paul Moore
Date: Fri Apr 11 2025 - 16:31:01 EST


On Mar 18, 2025 =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgoettsche@xxxxxxxxxxxxx> wrote:
>
> For network objects, like interfaces, nodes, port and InfiniBands, the
> object to SID lookup is cached in hashtables. OOM during such hashtable
> additions of new objects is considered non-fatal and the computed SID is
> simply returned without adding the compute result into the hash table.
>
> Actually ignore OOM in the InfiniBand code, despite the comment already
> suggesting to do so. This reverts commit c350f8bea271 ("selinux: Fix
> error return code in sel_ib_pkey_sid_slow()").
>
> Add comments in the other places.
>
> Use kmalloc() instead of kzalloc(), since all members are initialized on
> success and the data is only used in internbal hash tables, so no risk
> of information leakage to userspace.
>
> Fixes: c350f8bea271 ("selinux: Fix error return code in sel_ib_pkey_sid_slow()")
> Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>
> ---
> security/selinux/ibpkey.c | 11 +++++------
> security/selinux/netif.c | 6 +++++-
> security/selinux/netnode.c | 5 ++++-
> security/selinux/netport.c | 6 +++++-
> 4 files changed, 19 insertions(+), 9 deletions(-)

Merged into selinux/dev, thanks!

--
paul-moore.com