* [PATCH][next] RDMA/bnxt_re: fix or'ing of data into an uninitialized struct member
@ 2019-02-11 13:34 Colin King
2019-02-11 13:41 ` Devesh Sharma
2019-02-11 22:35 ` Jason Gunthorpe
0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2019-02-11 13:34 UTC (permalink / raw)
To: Selvin Xavier, Devesh Sharma, Somnath Kotur,
Sriharsha Basavapatna, Doug Ledford, Jason Gunthorpe, linux-rdma
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The struct member comp_mask has not been initialized however a bit
pattern is being bitwise or'd into the member and hence other bit
fields in comp_mask may contain any garbage from the stack. Fix this
by making the bitwise or into an assignment.
Fixes: 95b86d1c91ad ("RDMA/bnxt_re: Update kernel user abi to pass chip context")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/infiniband/hw/bnxt_re/ib_verbs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
index 1d7469e23cde..de5cb9a61a78 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
@@ -3720,7 +3720,7 @@ struct ib_ucontext *bnxt_re_alloc_ucontext(struct ib_device *ibdev,
}
spin_lock_init(&uctx->sh_lock);
- resp.comp_mask |= BNXT_RE_UCNTX_CMASK_HAVE_CCTX;
+ resp.comp_mask = BNXT_RE_UCNTX_CMASK_HAVE_CCTX;
chip_met_rev_num = rdev->chip_ctx.chip_num;
chip_met_rev_num |= ((u32)rdev->chip_ctx.chip_rev & 0xFF) <<
BNXT_RE_CHIP_ID0_CHIP_REV_SFT;
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH][next] RDMA/bnxt_re: fix or'ing of data into an uninitialized struct member
2019-02-11 13:34 [PATCH][next] RDMA/bnxt_re: fix or'ing of data into an uninitialized struct member Colin King
@ 2019-02-11 13:41 ` Devesh Sharma
2019-02-11 22:35 ` Jason Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Devesh Sharma @ 2019-02-11 13:41 UTC (permalink / raw)
To: Colin King
Cc: Selvin Xavier, Somnath Kotur, Sriharsha Basavapatna, Doug Ledford,
Jason Gunthorpe, linux-rdma, kernel-janitors, LKML
On Mon, Feb 11, 2019 at 7:04 PM Colin King <colin.king@canonical.com> wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> The struct member comp_mask has not been initialized however a bit
> pattern is being bitwise or'd into the member and hence other bit
> fields in comp_mask may contain any garbage from the stack. Fix this
> by making the bitwise or into an assignment.
>
> Fixes: 95b86d1c91ad ("RDMA/bnxt_re: Update kernel user abi to pass chip context")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/infiniband/hw/bnxt_re/ib_verbs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> index 1d7469e23cde..de5cb9a61a78 100644
> --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> @@ -3720,7 +3720,7 @@ struct ib_ucontext *bnxt_re_alloc_ucontext(struct ib_device *ibdev,
> }
> spin_lock_init(&uctx->sh_lock);
>
> - resp.comp_mask |= BNXT_RE_UCNTX_CMASK_HAVE_CCTX;
> + resp.comp_mask = BNXT_RE_UCNTX_CMASK_HAVE_CCTX;
> chip_met_rev_num = rdev->chip_ctx.chip_num;
> chip_met_rev_num |= ((u32)rdev->chip_ctx.chip_rev & 0xFF) <<
> BNXT_RE_CHIP_ID0_CHIP_REV_SFT;
> --
> 2.20.1
>
Thanks that was missed!
Acked-By: Devesh Sharma <devesh.sharma@broadcom.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][next] RDMA/bnxt_re: fix or'ing of data into an uninitialized struct member
2019-02-11 13:34 [PATCH][next] RDMA/bnxt_re: fix or'ing of data into an uninitialized struct member Colin King
2019-02-11 13:41 ` Devesh Sharma
@ 2019-02-11 22:35 ` Jason Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2019-02-11 22:35 UTC (permalink / raw)
To: Colin King
Cc: Selvin Xavier, Devesh Sharma, Somnath Kotur,
Sriharsha Basavapatna, Doug Ledford, linux-rdma, kernel-janitors,
linux-kernel
On Mon, Feb 11, 2019 at 01:34:15PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The struct member comp_mask has not been initialized however a bit
> pattern is being bitwise or'd into the member and hence other bit
> fields in comp_mask may contain any garbage from the stack. Fix this
> by making the bitwise or into an assignment.
>
> Fixes: 95b86d1c91ad ("RDMA/bnxt_re: Update kernel user abi to pass chip context")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> Acked-By: Devesh Sharma <devesh.sharma@broadcom.com>
> ---
> drivers/infiniband/hw/bnxt_re/ib_verbs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to for-next thanks
Jason
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-02-11 22:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-11 13:34 [PATCH][next] RDMA/bnxt_re: fix or'ing of data into an uninitialized struct member Colin King
2019-02-11 13:41 ` Devesh Sharma
2019-02-11 22:35 ` Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox