diff options
| author | Thorsten Blum <thorsten.blum@linux.dev> | 2026-02-05 01:07:35 +0300 |
|---|---|---|
| committer | John Johansen <john.johansen@canonical.com> | 2026-04-22 20:57:52 +0300 |
| commit | e6a522c5b4803b8f5632d5ce8f27431a1ae73222 (patch) | |
| tree | 9ee516d34472b60b057615ade80f1deef0acef4b | |
| parent | 46401cc99c6237ba825cfd65ef023955ce2a6316 (diff) | |
| download | linux-e6a522c5b4803b8f5632d5ce8f27431a1ae73222.tar.xz | |
apparmor: Remove redundant if check in sk_peer_get_label
Remove the redundant if check in sk_peer_get_label() and return
ERR_PTR(-ENOPROTOOPT) directly.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: John Johansen <john.johansen@canonical.com>
| -rw-r--r-- | security/apparmor/lsm.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c index 553f4127d59f..6f15b968a32a 100644 --- a/security/apparmor/lsm.c +++ b/security/apparmor/lsm.c @@ -1523,15 +1523,11 @@ static int apparmor_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb) static struct aa_label *sk_peer_get_label(struct sock *sk) { struct aa_sk_ctx *ctx = aa_sock(sk); - struct aa_label *label = ERR_PTR(-ENOPROTOOPT); if (rcu_access_pointer(ctx->peer)) return aa_get_label_rcu(&ctx->peer); - if (sk->sk_family != PF_UNIX) - return ERR_PTR(-ENOPROTOOPT); - - return label; + return ERR_PTR(-ENOPROTOOPT); } /** |
