ksmbd: fix error code in ndr_read_int32()
Subsystems (3)
PATCH 1/1 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 303fff2b8c77 ("ksmbd: add validation for ndr read/write functions")
Signed-off-by Dan Carpenter <[email protected]>
--- fs/ksmbd/ndr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ksmbd/ndr.c +1 -1
@@ -148,7 +148,7 @@ static int ndr_read_int16(struct ndr *n, __u16 *value)static int ndr_read_int32 (struct ndr *n,__u32 *value) {if (n->offset +sizeof (__u32) > n->length) -return 0 ; +return -EINVAL ;if (value) *value =le32_to_cpu (*(__le32 *)ndr_get_field (n));
Signature · 1 line
2.20.1
2021-11-30 21:50 GMT+09:00, Dan Carpenter <[email protected]>:
Quoted 5 lines
This is a failure path and it should return
-EINVALinstead of success. Otherwise it could result in the caller using uninitialized memory.Fixes 303fff2b8c77 ("ksmbd: add validation for ndr read/write functions")Signed-off-by Dan Carpenter <[email protected]>
Acked-by Namjae Jeon <[email protected]>
Thanks!