mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
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 <[email protected]> Acked-by: Eric Dumazet <[email protected]> Reviewed-by: Julian Calaby <[email protected]> Signed-off-by: Cong Wang <[email protected]> Signed-off-by: Samuel Ortiz <[email protected]>
This commit is contained in:
parent
667f00630e
commit
81ca7835f2
1 changed files with 2 additions and 2 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue