* [PATCH net] octeontx2-af: Fix an off by one in rvu_dbg_qsize_write()
@ 2021-02-19 9:56 Dan Carpenter
2021-02-19 18:28 ` Jakub Kicinski
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-02-19 9:56 UTC (permalink / raw)
To: Sunil Goutham, Christina Jacob
Cc: Linu Cherian, Geetha sowjanya, Jerin Jacob, hariprasad,
Subbaraya Sundeep, David S. Miller, Jakub Kicinski,
Prakash Brahmajyosyula, netdev, kernel-janitors
This code does not allocate enough memory for the NUL terminator so it
ends up putting it one character beyond the end of the buffer.
Fixes: 8756828a8148 ("octeontx2-af: Add NPA aura and pool contexts to debugfs")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
index 48a84c65804c..d5f3ad660588 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
@@ -385,7 +385,7 @@ static ssize_t rvu_dbg_qsize_write(struct file *filp,
u16 pcifunc;
int ret, lf;
- cmd_buf = memdup_user(buffer, count);
+ cmd_buf = memdup_user(buffer, count + 1);
if (IS_ERR(cmd_buf))
return -ENOMEM;
--
2.30.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] octeontx2-af: Fix an off by one in rvu_dbg_qsize_write()
2021-02-19 9:56 [PATCH net] octeontx2-af: Fix an off by one in rvu_dbg_qsize_write() Dan Carpenter
@ 2021-02-19 18:28 ` Jakub Kicinski
2021-02-19 18:36 ` Sunil Kovvuri
2021-02-21 21:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2021-02-19 18:28 UTC (permalink / raw)
To: Dan Carpenter
Cc: Sunil Goutham, Christina Jacob, Linu Cherian, Geetha sowjanya,
Jerin Jacob, hariprasad, Subbaraya Sundeep, David S. Miller,
Prakash Brahmajyosyula, netdev, kernel-janitors
On Fri, 19 Feb 2021 12:56:32 +0300 Dan Carpenter wrote:
> This code does not allocate enough memory for the NUL terminator so it
> ends up putting it one character beyond the end of the buffer.
>
> Fixes: 8756828a8148 ("octeontx2-af: Add NPA aura and pool contexts to debugfs")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Fix looks correct, thanks! The interface itself is another matter..
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] octeontx2-af: Fix an off by one in rvu_dbg_qsize_write()
2021-02-19 9:56 [PATCH net] octeontx2-af: Fix an off by one in rvu_dbg_qsize_write() Dan Carpenter
2021-02-19 18:28 ` Jakub Kicinski
@ 2021-02-19 18:36 ` Sunil Kovvuri
2021-02-21 21:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Sunil Kovvuri @ 2021-02-19 18:36 UTC (permalink / raw)
To: Dan Carpenter
Cc: Sunil Goutham, Christina Jacob, Linu Cherian, Geetha sowjanya,
Jerin Jacob, hariprasad, Subbaraya Sundeep, David S. Miller,
Jakub Kicinski, Prakash Brahmajyosyula, Linux Netdev List,
kernel-janitors
On Fri, Feb 19, 2021 at 3:31 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> This code does not allocate enough memory for the NUL terminator so it
> ends up putting it one character beyond the end of the buffer.
>
> Fixes: 8756828a8148 ("octeontx2-af: Add NPA aura and pool contexts to debugfs")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
> index 48a84c65804c..d5f3ad660588 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
> @@ -385,7 +385,7 @@ static ssize_t rvu_dbg_qsize_write(struct file *filp,
> u16 pcifunc;
> int ret, lf;
>
> - cmd_buf = memdup_user(buffer, count);
> + cmd_buf = memdup_user(buffer, count + 1);
> if (IS_ERR(cmd_buf))
> return -ENOMEM;
>
> --
> 2.30.0
>
Thanks for the fix.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] octeontx2-af: Fix an off by one in rvu_dbg_qsize_write()
2021-02-19 9:56 [PATCH net] octeontx2-af: Fix an off by one in rvu_dbg_qsize_write() Dan Carpenter
2021-02-19 18:28 ` Jakub Kicinski
2021-02-19 18:36 ` Sunil Kovvuri
@ 2021-02-21 21:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-02-21 21:40 UTC (permalink / raw)
To: Dan Carpenter
Cc: sgoutham, cjacob, lcherian, gakula, jerinj, hkelam, sbhatta,
davem, kuba, bprakash, netdev, kernel-janitors
Hello:
This patch was applied to netdev/net.git (refs/heads/master):
On Fri, 19 Feb 2021 12:56:32 +0300 you wrote:
> This code does not allocate enough memory for the NUL terminator so it
> ends up putting it one character beyond the end of the buffer.
>
> Fixes: 8756828a8148 ("octeontx2-af: Add NPA aura and pool contexts to debugfs")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Here is the summary with links:
- [net] octeontx2-af: Fix an off by one in rvu_dbg_qsize_write()
https://git.kernel.org/netdev/net/c/3a2eb515d136
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-02-21 21:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-19 9:56 [PATCH net] octeontx2-af: Fix an off by one in rvu_dbg_qsize_write() Dan Carpenter
2021-02-19 18:28 ` Jakub Kicinski
2021-02-19 18:36 ` Sunil Kovvuri
2021-02-21 21:40 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.