OSDN Git Service

CIFS: fix wrapping bugs in num_entries()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 6 Sep 2018 09:48:22 +0000 (12:48 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Sep 2018 06:36:37 +0000 (08:36 +0200)
commitfe6198c278540430238955f8e9de0e71bfce712d
tree93985afc497ac6b1cf126d5ff5a0572a010af14b
parentca453b2406a6d64b97b165b19eaf6848d2516153
CIFS: fix wrapping bugs in num_entries()

commit 56446f218af1133c802dad8e9e116f07f381846c upstream.

The problem is that "entryptr + next_offset" and "entryptr + len + size"
can wrap.  I ended up changing the type of "entryptr" because it makes
the math easier when we don't have to do so much casting.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
CC: Stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/smb2pdu.c