Skip to content

Commit b723097

Browse files
Zihan Xigregkh
authored andcommitted
smb: client: use unaligned reads in parse_posix_ctxt()
commit b86467c upstream. The server controls create-context DataOffset, so the POSIX context data pointer may be misaligned on strict-alignment architectures. Use get_unaligned_le32() when reading nlink, reparse_tag, and mode. Fixes: 69dda30 ("cifs: add SMB2_open() arg to return POSIX data") Cc: stable@vger.kernel.org Signed-off-by: Zihan Xi <xizh2024@lzu.edu.cn> Signed-off-by: Ren Wei <n05ec@lzu.edu.cn> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9136a08 commit b723097

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

fs/smb/client/smb2pdu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2307,9 +2307,9 @@ parse_posix_ctxt(struct create_context *cc, struct smb2_file_all_info *info,
23072307

23082308
memset(posix, 0, sizeof(*posix));
23092309

2310-
posix->nlink = le32_to_cpu(*(__le32 *)(beg + 0));
2311-
posix->reparse_tag = le32_to_cpu(*(__le32 *)(beg + 4));
2312-
posix->mode = le32_to_cpu(*(__le32 *)(beg + 8));
2310+
posix->nlink = get_unaligned_le32(beg);
2311+
posix->reparse_tag = get_unaligned_le32(beg + 4);
2312+
posix->mode = get_unaligned_le32(beg + 8);
23132313

23142314
sid = beg + 12;
23152315
sid_len = posix_info_sid_size(sid, end);

0 commit comments

Comments
 (0)