summaryrefslogtreecommitdiffstats
path: root/net/nfc
diff options
context:
space:
mode:
authorCong Wang <xiyou.wangcong@gmail.com>2016-01-29 20:24:24 +0100
committerSamuel Ortiz <sameo@linux.intel.com>2016-02-25 08:40:55 +0100
commit81ca7835f2cb0c3ba4236e3bcf31d997c6f5d71a (patch)
tree5ca43bb47ccc627193473702e140b70b036c66a1 /net/nfc
parentMerge branch 'local-checksum-offload' (diff)
downloadlinux-81ca7835f2cb0c3ba4236e3bcf31d997c6f5d71a.tar.xz
linux-81ca7835f2cb0c3ba4236e3bcf31d997c6f5d71a.zip
NFC: Use GFP_USER for user-controlled kmalloc
These two functions are called in sendmsg path, and the 'len' is passed from user-space, so we should not allow malicious users to OOM kernel on purpose. Reported-by: Dmitry Vyukov <dvyukov@google.com> Acked-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Julian Calaby <julian.calaby@gmail.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/llcp_commands.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/nfc/llcp_commands.c b/net/nfc/llcp_commands.c
index 3621a902cb6e..3425532c39f7 100644
--- a/net/nfc/llcp_commands.c
+++ b/net/nfc/llcp_commands.c
@@ -663,7 +663,7 @@ int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock,
return -ENOBUFS;
}
- msg_data = kzalloc(len, GFP_KERNEL);
+ msg_data = kmalloc(len, GFP_USER | __GFP_NOWARN);
if (msg_data == NULL)
return -ENOMEM;
@@ -729,7 +729,7 @@ int nfc_llcp_send_ui_frame(struct nfc_llcp_sock *sock, u8 ssap, u8 dsap,
if (local == NULL)
return -ENODEV;
- msg_data = kzalloc(len, GFP_KERNEL);
+ msg_data = kmalloc(len, GFP_USER | __GFP_NOWARN);
if (msg_data == NULL)
return -ENOMEM;