From: Jeff Layton Date: Fri, 29 Apr 2011 10:52:44 +0000 (-0400) Subject: cifs: handle errors from coalesce_t2 X-Git-Tag: v2.6.38.7~67 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=ef65b13bc0be7792c8982264209d782f8ee1dd3c;p=karo-tx-linux.git cifs: handle errors from coalesce_t2 commit 16541ba11c4f04ffe94b073e301f00b749fb84a1 upstream. cifs_demultiplex_thread calls coalesce_t2 to try and merge follow-on t2 responses into the original mid buffer. coalesce_t2 however can return errors, but the caller doesn't handle that situation properly. Fix the thread to treat such a case as it would a malformed packet. Mark the mid as being malformed and issue the callback. Acked-by: David Howells Signed-off-by: Jeff Layton Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 073db5d78620..0fd3855a161a 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -631,12 +631,16 @@ incomplete_rcv: isMultiRsp = true; if (mid_entry->resp_buf) { /* merge response - fix up 1st*/ - if (coalesce_t2(smb_buffer, - mid_entry->resp_buf)) { + length = coalesce_t2(smb_buffer, + mid_entry->resp_buf); + if (length > 0) { + length = 0; mid_entry->multiRsp = true; break; } else { - /* all parts received */ + /* all parts received or + * packet is malformed + */ mid_entry->multiEnd = true; goto multi_t2_fnd; }