nfc: use GFP_USER for user-controlled kmalloc
Subsystems (3)
PATCH v2 1/1 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.
--- net/nfc/llcp_commands.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/nfc/llcp_commands.c +2 -2
@@ -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 ;
Signature · 6 lines
1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · Cong Wang
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]>Cc Lauro Ramos Venancio <[email protected]>Cc Aloisio Almeida Jr <[email protected]>Cc Samuel Ortiz <[email protected]>Signed-off-by Cong Wang <[email protected]>---
Note that the issue is not OOM the kernel (as the allocation is attempted even after your patch), but having a way to spill stack traces in the syslog.
Thanks!
Julian Calaby
Reviewed-byHi Cong
Quoted 12 lines · Eric Dumazet
Quoted 10 lines · Cong Wang
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]>Cc Lauro Ramos Venancio <[email protected]>Cc Aloisio Almeida Jr <[email protected]>Cc Samuel Ortiz <[email protected]>Signed-off-by Cong Wang <[email protected]>---
Quoted 5 lines
Note that the issue is not OOM the kernel (as the allocation is attempted even after your patch), but having a way to spill stack traces in the syslog.
Acked-by Eric Dumazet <[email protected]>
Thanks,
Signature · 4 lines
Julian Calaby Email: [email protected] Profile: http://www.google.com/profiles/julian.calaby/
Quoted 9 lines · Cong Wang
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]>Cc Lauro Ramos Venancio <[email protected]>Cc Aloisio Almeida Jr <[email protected]>Cc Samuel Ortiz <sameo-VuQAYsv1563Yd54FQh9/[email protected]>Signed-off-by Cong Wang <[email protected]>
Ping...
David, this patch seems still not applied, I guess you expect NFC maintainer to take it, but this doesn't happen. Could you take it?
(I can resend it if you need.)
Thanks!
Quoted 27 lines
--- net/nfc/llcp_commands.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)net/nfc/llcp_commands.c +2
-3@@ -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 ; --
Quoted 2 lines
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
David Miller
maintainerFrom: Cong Wang <[email protected]>
Date: Wed, 24 Feb 2016 10:41:29 -0800
Quoted 11 lines · Cong Wang
Quoted 9 lines
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]>Cc Lauro Ramos Venancio <[email protected]>Cc Aloisio Almeida Jr <[email protected]>Cc Samuel Ortiz <[email protected]>Signed-off-by Cong Wang <[email protected]>
Quoted 4 lines
Ping...
David, this patch seems still not applied, I guess you expect NFC maintainer to take it, but this doesn't happen. Could you take it?
The NFC maintainer needs to take this, ping them explicitly if you have to.
Thanks.
Quoted 11 lines · Cong Wang
Quoted 9 lines · Cong Wang
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]>Cc Lauro Ramos Venancio <[email protected]>Cc Aloisio Almeida Jr <[email protected]>Cc Samuel Ortiz <sameo-VuQAYsv1563Yd54FQh9/[email protected]>Signed-off-by Cong Wang <[email protected]>
Quoted 4 lines
Ping...
David, this patch seems still not applied, I guess you expect NFC maintainer to take it, but this doesn't happen. Could you take it?
I'll look at it later today.
Cheers,
Samuel.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 14 lines · David Miller
From: Cong Wang <[email protected]>
Date: Wed, 24 Feb 2016 10:41:29 -0800Quoted 11 lines · Cong Wang
Quoted 9 lines
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]>Cc Lauro Ramos Venancio <[email protected]>Cc Aloisio Almeida Jr <[email protected]>Cc Samuel Ortiz <sameo-VuQAYsv1563Yd54FQh9/[email protected]>Signed-off-by Cong Wang <[email protected]>
Quoted 7 lines
Quoted 4 lines
Ping...
David, this patch seems still not applied, I guess you expect NFC maintainer to take it, but this doesn't happen. Could you take it?
The NFC maintainer needs to take this, ping them explicitly if you have to.
OK. I think Samuel is looking at it now.
Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Samuel Ortiz
AppliedHi Cong,
Quoted 4 lines · Cong Wang
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.
Quoted 8 lines
Reported-by Dmitry Vyukov <[email protected]>Cc Lauro Ramos Venancio <[email protected]>Cc Aloisio Almeida Jr <[email protected]>Cc Samuel Ortiz <sameo-VuQAYsv1563Yd54FQh9/[email protected]>Signed-off-by Cong Wang <[email protected]>--- net/nfc/llcp_commands.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Applied to nfc-next, thanks.
Cheers,
Samuel.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html