New issue
Advanced search Search tips

Issue 782439 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

key refcount leak in keyctl_read_key()

Project Member Reported by groeck@chromium.org, Nov 7 2017

Issue description

Upstream commit 7fc0786d956:

KEYS: fix key refcount leak in keyctl_read_key()
    
    In keyctl_read_key(), if key_permission() were to return an error code
    other than EACCES, we would leak a the reference to the key.  This can't
    actually happen currently because key_permission() can only return an
    error code other than EACCES if security_key_permission() does, only
    SELinux and Smack implement that hook, and neither can return an error
    code other than EACCES.  But it should still be fixed, as it is a bug
    waiting to happen.

 
Status: Started (was: Assigned)
Project Member

Comment 2 by bugdroid1@chromium.org, Nov 8 2017

Labels: merge-merged-chromeos-4.4
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/44efc751cabe09b3cfff7b173aa6276004229f9a

commit 44efc751cabe09b3cfff7b173aa6276004229f9a
Author: Eric Biggers <ebiggers@google.com>
Date: Wed Nov 08 11:12:30 2017

UPSTREAM: KEYS: fix key refcount leak in keyctl_read_key()

In keyctl_read_key(), if key_permission() were to return an error code
other than EACCES, we would leak a the reference to the key.  This can't
actually happen currently because key_permission() can only return an
error code other than EACCES if security_key_permission() does, only
SELinux and Smack implement that hook, and neither can return an error
code other than EACCES.  But it should still be fixed, as it is a bug
waiting to happen.

BUG= chromium:782439 
TEST=Build and run

Change-Id: Ib55fb124888114bb5c661af4a5f5fa84ef826344
Fixes: 29db91906340 ("[PATCH] Keys: Add LSM hooks for key management [try #3]")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Guenter Roeck <groeck@chromium.org>
(cherry picked from commit 7fc0786d956d9e59b68d282be9b156179846ea3d)
Reviewed-on: https://chromium-review.googlesource.com/757762
Reviewed-by: Daniel Wang <wonderfly@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/44efc751cabe09b3cfff7b173aa6276004229f9a/security/keys/keyctl.c

Status: Fixed (was: Started)

Sign in to add a comment