fs/cifs: fix parsing of dfs referrals
authorStefan Metzmacher <[email protected]>
Thu, 3 May 2012 22:19:28 +0000 (00:19 +0200)
committerSteve French <[email protected]>
Fri, 4 May 2012 03:47:39 +0000 (22:47 -0500)
The problem was that the first referral was parsed more than once
and so the caller tried the same referrals multiple times.

The problem was introduced partly by commit
066ce6899484d9026acd6ba3a8dbbedb33d7ae1b,
where 'ref += le16_to_cpu(ref->Size);' got lost,
but that was also wrong...

Cc: <[email protected]>
Signed-off-by: Stefan Metzmacher <[email protected]>
Tested-by: Björn Jacke <[email protected]>
Reviewed-by: Jeff Layton <[email protected]>
Signed-off-by: Steve French <[email protected]>
fs/cifs/cifssmb.c

index f52c5ab78f9dde7fa782bbb2ca26e7da70e450af..da2f5446fa7ae3d3bbba6bb1b7a92cd1cc8743e4 100644 (file)
@@ -4844,8 +4844,12 @@ parse_DFS_referrals(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr,
                max_len = data_end - temp;
                node->node_name = cifs_strndup_from_utf16(temp, max_len,
                                                is_unicode, nls_codepage);
-               if (!node->node_name)
+               if (!node->node_name) {
                        rc = -ENOMEM;
+                       goto parse_DFS_referrals_exit;
+               }
+
+               ref++;
        }
 
 parse_DFS_referrals_exit: