mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] cifs: fix buffer overrun in parse_DFS_referrals
@ 2008-12-16 15:04 Jeff Layton
  2008-12-17  3:34 ` Steve French
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Layton @ 2008-12-16 15:04 UTC (permalink / raw)
  To: smfrench, niallain
  Cc: smfrench, linux-cifs-client, linux-fsdevel, linux-kernel

While testing a kernel with memory poisoning enabled, I saw some warnings
about the redzone getting clobbered when chasing DFS referrals. The
buffer allocation for the unicode converted version of the searchName is
too small and needs to take null termination into account.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 fs/cifs/cifssmb.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 9395928..824df14 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -3992,7 +3992,8 @@ parse_DFS_referrals(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr,
 
 		node->flags = le16_to_cpu(pSMBr->DFSFlags);
 		if (is_unicode) {
-			__le16 *tmp = kmalloc(strlen(searchName)*2, GFP_KERNEL);
+			__le16 *tmp = kmalloc(strlen(searchName)*2 + 2,
+						GFP_KERNEL);
 			cifsConvertToUCS((__le16 *) tmp, searchName,
 					PATH_MAX, nls_codepage, remap);
 			node->path_consumed = hostlen_fromUCS(tmp,
-- 
1.5.5.1


^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH] cifs: fix buffer overrun in parse_DFS_referrals
@ 2008-12-17 11:31 Jeff Layton
  2008-12-17 15:40 ` Renato S. Yamane
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Layton @ 2008-12-17 11:31 UTC (permalink / raw)
  To: torvalds, sfrench; +Cc: linux-kernel, stable, linux-cifs-client, linux-fsdevel

While testing a kernel with memory poisoning enabled, I saw some warnings
about the redzone getting clobbered when chasing DFS referrals. The
buffer allocation for the unicode converted version of the searchName is
too small and needs to take null termination into account.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Acked-by: Steve French <sfrench@us.ibm.com>
---
 fs/cifs/cifssmb.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 9395928..824df14 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -3992,7 +3992,8 @@ parse_DFS_referrals(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr,
 
 		node->flags = le16_to_cpu(pSMBr->DFSFlags);
 		if (is_unicode) {
-			__le16 *tmp = kmalloc(strlen(searchName)*2, GFP_KERNEL);
+			__le16 *tmp = kmalloc(strlen(searchName)*2 + 2,
+						GFP_KERNEL);
 			cifsConvertToUCS((__le16 *) tmp, searchName,
 					PATH_MAX, nls_codepage, remap);
 			node->path_consumed = hostlen_fromUCS(tmp,
-- 
1.5.5.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-12-17 15:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-16 15:04 [PATCH] cifs: fix buffer overrun in parse_DFS_referrals Jeff Layton
2008-12-17  3:34 ` Steve French
2008-12-17 11:31 Jeff Layton
2008-12-17 15:40 ` Renato S. Yamane
2008-12-17 15:49   ` Jeff Layton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®