Message ID | YC+LUJ0YhF1Yutaw@mwanda (mailing list archive) |
---|---|
State | Accepted |
Commit | 3a2eb515d1367c0f667b76089a6e727279c688b8 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net] octeontx2-af: Fix an off by one in rvu_dbg_qsize_write() | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | success | CCed 9 of 9 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 8 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
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..
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.
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
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;
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(-)