diff mbox

[23/25] LSM: Correct allocation mode for sock blobs

Message ID deedc536-a7cc-8fce-3837-5e77e2a37fc7@schaufler-ca.com (mailing list archive)
State New, archived
Headers show

Commit Message

Casey Schaufler Aug. 13, 2016, 8:38 p.m. UTC
Subject: [PATCH 23/25] LSM: Correct allocation mode for sock blobs

Use the passed gfp mode for allocating socket blobs.

Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
---
 security/security.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/security/security.c b/security/security.c
index 9eade94..e194679 100644
--- a/security/security.c
+++ b/security/security.c
@@ -373,12 +373,13 @@  int lsm_msg_msg_alloc(struct msg_msg *mp)
 /**
  * lsm_sock_alloc - allocate a composite sock blob
  * @sock: the sock that needs a blob
+ * @priority: allocation mode
  *
  * Allocate the sock blob for all the modules
  *
  * Returns 0, or -ENOMEM if memory can't be allocated.
  */
-int lsm_sock_alloc(struct sock *sock)
+int lsm_sock_alloc(struct sock *sock, gfp_t priority)
 {
 #ifdef CONFIG_SECURITY_STACKING_DEBUG
 	if (sock->sk_security) {
@@ -389,7 +390,7 @@  int lsm_sock_alloc(struct sock *sock)
 	if (blob_sizes.lbs_sock == 0)
 		return 0;
 
-	sock->sk_security = kzalloc(blob_sizes.lbs_sock, GFP_KERNEL);
+	sock->sk_security = kzalloc(blob_sizes.lbs_sock, priority);
 	if (sock->sk_security == NULL)
 		return -ENOMEM;
 	return 0;
@@ -1822,7 +1823,7 @@  EXPORT_SYMBOL(security_socket_getpeersec_dgram);
 
 int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
 {
-	int rc = lsm_sock_alloc(sk);
+	int rc = lsm_sock_alloc(sk, priority);
 
 	if (rc)
 		return rc;