Skip to contentSkip to conversation

scm: fix a typo in put_cmsg()

PATCH Applied Eric Dumazet 4 participants 4 messages Apr 16, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scm: fix a typo in put_cmsg()

From: Eric Dumazet <[email protected]>

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

Fixes 38ebcf5096a8 ("scm: optimize put_cmsg()")
---
 net/core/scm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/scm.c +1 -1
index bd96c922041d22a2f3b7ee73e4b3183316f9b616..ae3085d9aae8adb81d3bb42c8a915a205476a0ee 100644
@@ -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,
Signature · 1 line
2.31.1.368.gbe11c130af-goog
maintainer Tested-by on v1 1/1
#2 lore raw
In reply to Eric Dumazet
Quoted 7 lines · On Fri, 16 Apr 2021 11:35:38 -0700 Eric Dumazet wrote:

From: Eric Dumazet <[email protected]>

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

Fixes 38ebcf5096a8 ("scm: optimize put_cmsg()")

FWIW can confirm it fixes the issue:

Thanks!

#3 lore raw
In reply to Eric Dumazet
This patch was applied to netdev/net-next.git (refs/heads/master):

Hello:

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

Quoted 9 lines · On Fri, 16 Apr 2021 11:35:38 -0700 you wrote:

From: Eric Dumazet <[email protected]>

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

Fixes 38ebcf5096a8 ("scm: optimize put_cmsg()")

[...]

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