Skip to content

Commit ef39946

Browse files
Dan Carpentersmfrench
authored andcommitted
ksmbd: fix error code in ndr_read_int32()
This is a failure path and it should return -EINVAL instead of success. Otherwise it could result in the caller using uninitialized memory. Fixes: 303fff2 ("ksmbd: add validation for ndr read/write functions") Cc: stable@vger.kernel.org # v5.15 Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 2585cf9 commit ef39946

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/ksmbd/ndr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ static int ndr_read_int16(struct ndr *n, __u16 *value)
148148
static int ndr_read_int32(struct ndr *n, __u32 *value)
149149
{
150150
if (n->offset + sizeof(__u32) > n->length)
151-
return 0;
151+
return -EINVAL;
152152

153153
if (value)
154154
*value = le32_to_cpu(*(__le32 *)ndr_get_field(n));

0 commit comments

Comments
 (0)