diff mbox series

[net-next] scm: fix a typo in put_cmsg()

Message ID 20210416183538.1194197-1-eric.dumazet@gmail.com (mailing list archive)
State Accepted
Commit e7ad33fa7bc5f788cdb14eea68c65c4da0f06edf
Delegated to: Netdev Maintainers
Headers show
Series [net-next] scm: fix a typo in put_cmsg() | expand

Checks

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-next
netdev/subject_prefix success Link
netdev/cc_maintainers fail 1 blamed authors not CCed: soheil@google.com; 4 maintainers not CCed: sargun@sargun.me christian.brauner@ubuntu.com keescook@chromium.org soheil@google.com
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: 1 this patch: 1
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: 1 this patch: 1
netdev/header_inline success Link

Commit Message

Eric Dumazet April 16, 2021, 6:35 p.m. UTC
From: Eric Dumazet <edumazet@google.com>

We need to store cmlen instead of len in cm->cmsg_len.

Fixes: 38ebcf5096a8 ("scm: optimize put_cmsg()")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Jakub Kicinski <kuba@kernel.org>
---
 net/core/scm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ido Schimmel April 16, 2021, 6:40 p.m. UTC | #1
On Fri, Apr 16, 2021 at 11:35:38AM -0700, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> We need to store cmlen instead of len in cm->cmsg_len.
> 
> Fixes: 38ebcf5096a8 ("scm: optimize put_cmsg()")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Reported-by: Jakub Kicinski <kuba@kernel.org>

Tested-by: Ido Schimmel <idosch@nvidia.com>

(I was about to bisect, but then noticed the report from Jakub)

Thanks!
Jakub Kicinski April 16, 2021, 6:43 p.m. UTC | #2
On Fri, 16 Apr 2021 11:35:38 -0700 Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> We need to store cmlen instead of len in cm->cmsg_len.
> 
> Fixes: 38ebcf5096a8 ("scm: optimize put_cmsg()")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Reported-by: Jakub Kicinski <kuba@kernel.org>

FWIW can confirm it fixes the issue:

Tested-by: Jakub Kicinski <kuba@kernel.org>

Thanks!
patchwork-bot+netdevbpf@kernel.org April 16, 2021, 6:50 p.m. UTC | #3
Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Fri, 16 Apr 2021 11:35:38 -0700 you wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> We need to store cmlen instead of len in cm->cmsg_len.
> 
> Fixes: 38ebcf5096a8 ("scm: optimize put_cmsg()")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Reported-by: Jakub Kicinski <kuba@kernel.org>
> 
> [...]

Here is the summary with links:
  - [net-next] scm: fix a typo in put_cmsg()
    https://git.kernel.org/netdev/net-next/c/e7ad33fa7bc5

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/net/core/scm.c b/net/core/scm.c
index bd96c922041d22a2f3b7ee73e4b3183316f9b616..ae3085d9aae8adb81d3bb42c8a915a205476a0ee 100644
--- a/net/core/scm.c
+++ b/net/core/scm.c
@@ -232,7 +232,7 @@  int put_cmsg(struct msghdr * msg, int level, int type, int len, void *data)
 		if (!user_write_access_begin(cm, cmlen))
 			goto efault;
 
-		unsafe_put_user(len, &cm->cmsg_len, efault_end);
+		unsafe_put_user(cmlen, &cm->cmsg_len, efault_end);
 		unsafe_put_user(level, &cm->cmsg_level, efault_end);
 		unsafe_put_user(type, &cm->cmsg_type, efault_end);
 		unsafe_copy_to_user(CMSG_USER_DATA(cm), data,