* [PATCH next] RDMA/bnxt_re: Fix buffer overflow in debugfs code
@ 2025-02-07 9:16 Dan Carpenter
2025-02-08 13:19 ` Selvin Xavier
2025-02-09 9:58 ` Leon Romanovsky
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2025-02-07 9:16 UTC (permalink / raw)
To: Selvin Xavier
Cc: Kalesh AP, Jason Gunthorpe, Leon Romanovsky, linux-rdma,
linux-kernel, kernel-janitors
Add some bounds checking to prevent memory corruption in
bnxt_re_cc_config_set(). This is debugfs code so the bug can only be
triggered by root.
Fixes: 656dff55da19 ("RDMA/bnxt_re: Congestion control settings using debugfs hook")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/infiniband/hw/bnxt_re/debugfs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/infiniband/hw/bnxt_re/debugfs.c b/drivers/infiniband/hw/bnxt_re/debugfs.c
index f4dd2fb51867..d7354e7753fe 100644
--- a/drivers/infiniband/hw/bnxt_re/debugfs.c
+++ b/drivers/infiniband/hw/bnxt_re/debugfs.c
@@ -285,6 +285,9 @@ static ssize_t bnxt_re_cc_config_set(struct file *filp, const char __user *buffe
u32 val;
int rc;
+ if (count >= sizeof(buf))
+ return -EINVAL;
+
if (copy_from_user(buf, buffer, count))
return -EFAULT;
--
2.47.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH next] RDMA/bnxt_re: Fix buffer overflow in debugfs code
2025-02-07 9:16 [PATCH next] RDMA/bnxt_re: Fix buffer overflow in debugfs code Dan Carpenter
@ 2025-02-08 13:19 ` Selvin Xavier
2025-02-09 9:58 ` Leon Romanovsky
1 sibling, 0 replies; 3+ messages in thread
From: Selvin Xavier @ 2025-02-08 13:19 UTC (permalink / raw)
To: Dan Carpenter
Cc: Kalesh AP, Jason Gunthorpe, Leon Romanovsky, linux-rdma,
linux-kernel, kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1131 bytes --]
On Fri, Feb 7, 2025 at 2:46 PM Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> Add some bounds checking to prevent memory corruption in
> bnxt_re_cc_config_set(). This is debugfs code so the bug can only be
> triggered by root.
>
> Fixes: 656dff55da19 ("RDMA/bnxt_re: Congestion control settings using debugfs hook")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Selvin Xavier <selvin.xavier@broadcom.com>
Thanks,
Selvin
> ---
> drivers/infiniband/hw/bnxt_re/debugfs.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/infiniband/hw/bnxt_re/debugfs.c b/drivers/infiniband/hw/bnxt_re/debugfs.c
> index f4dd2fb51867..d7354e7753fe 100644
> --- a/drivers/infiniband/hw/bnxt_re/debugfs.c
> +++ b/drivers/infiniband/hw/bnxt_re/debugfs.c
> @@ -285,6 +285,9 @@ static ssize_t bnxt_re_cc_config_set(struct file *filp, const char __user *buffe
> u32 val;
> int rc;
>
> + if (count >= sizeof(buf))
> + return -EINVAL;
> +
> if (copy_from_user(buf, buffer, count))
> return -EFAULT;
>
> --
> 2.47.2
>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4224 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH next] RDMA/bnxt_re: Fix buffer overflow in debugfs code
2025-02-07 9:16 [PATCH next] RDMA/bnxt_re: Fix buffer overflow in debugfs code Dan Carpenter
2025-02-08 13:19 ` Selvin Xavier
@ 2025-02-09 9:58 ` Leon Romanovsky
1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2025-02-09 9:58 UTC (permalink / raw)
To: Selvin Xavier, Dan Carpenter
Cc: Kalesh AP, Jason Gunthorpe, linux-rdma, linux-kernel,
kernel-janitors
On Fri, 07 Feb 2025 12:16:19 +0300, Dan Carpenter wrote:
> Add some bounds checking to prevent memory corruption in
> bnxt_re_cc_config_set(). This is debugfs code so the bug can only be
> triggered by root.
>
>
Applied, thanks!
[1/1] RDMA/bnxt_re: Fix buffer overflow in debugfs code
https://git.kernel.org/rdma/rdma/c/dbc641ecf1cbd4
Best regards,
--
Leon Romanovsky <leon@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-09 9:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-07 9:16 [PATCH next] RDMA/bnxt_re: Fix buffer overflow in debugfs code Dan Carpenter
2025-02-08 13:19 ` Selvin Xavier
2025-02-09 9:58 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox