infiniband: Fix uninit-value in ucma_connect()
PATCH 1/1 infiniband: Fix uninit-value in ucma_connect()
ucma_connect() is reading uninitialized memory when in_len is less than offsetof(struct rdma_ucm_connect, ece). Fix it.
--- drivers/infiniband/core/ucma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/ucma.c +1 -1
@@ -1079,7 +1079,7 @@ static ssize_t ucma_connect(struct ucma_file *file, const char __user *inbuf, {struct rdma_conn_param conn_param;struct rdma_ucm_ece ece = {}; -struct rdma_ucm_connect cmd; +struct rdma_ucm_connect cmd = {};struct ucma_context *ctx;size_t in_size;int ret;
Signature · 1 line
2.25.1
PATCH 1/1 infiniband: Prevent uninit-value in ucma_accept()
ucma_accept() is reading uninitialized memory when in_len is less than offsetof(struct rdma_ucm_accept, ece). Fix it.
--- drivers/infiniband/core/ucma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/ucma.c +1 -1
@@ -1134,7 +1134,7 @@ static ssize_t ucma_listen(struct ucma_file *file, const char __user *inbuf,static ssize_t ucma_accept (struct ucma_file *file,const char __user *inbuf,int in_len,int out_len) { -struct rdma_ucm_accept cmd; +struct rdma_ucm_accept cmd = {};struct rdma_conn_param conn_param;struct rdma_ucm_ece ece = {};struct ucma_context *ctx;
Signature · 6 lines
2.25.1 _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
PATCH v2 1/1 infiniband: Prevent uninit-value in ucma_accept()
ucma_accept() is reading uninitialized memory when in_len is less than offsetof(struct rdma_ucm_accept, ece). Fix it.
---
Change in v2:
- syzbot has reported this bug as "KMSAN: uninit-value in xa_load". Add "Reported-and-tested-by:" and "Link:" tags for it.
drivers/infiniband/core/ucma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/ucma.c +1 -1
@@ -1134,7 +1134,7 @@ static ssize_t ucma_listen(struct ucma_file *file, const char __user *inbuf,static ssize_t ucma_accept (struct ucma_file *file,const char __user *inbuf,int in_len,int out_len) { -struct rdma_ucm_accept cmd; +struct rdma_ucm_accept cmd = {};struct rdma_conn_param conn_param;struct rdma_ucm_ece ece = {};struct ucma_context *ctx;
Signature · 1 line
2.25.1
Re: [Linux-kernel-mentees] [PATCH v2] infiniband: Prevent uninit-value in ucma_accept()
Quoted 6 lines · Peilin Ye
ucma_accept()is reading uninitialized memory whenin_lenis less thanoffsetof(struct rdma_ucm_accept, ece). Fix it.Reported-and-tested-by [email protected]Signed-off-by Peilin Ye <[email protected]>
Quoted 7 lines
---
Change in v2:
- syzbot has reported this bug as "KMSAN: uninit-value inxa_load". Add "Reported-and-tested-by:" and "Link:" tags for it.drivers/infiniband/core/ucma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Already fixed:
https://lore.kernel.org/r/[email protected]
Jason