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:38:08 +0000 (08:38 +0200)
commitf3259909c85e815ca474bd745a8465f67cdecd17
tree3933f96d30fbbd509bbaccb28c757e705a32bf66
parent20c8102b322efc8a6f206714a1e0e5db1817aef6
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