Skip to content

Commit

Permalink
scm: fix a typo in put_cmsg()
Browse files Browse the repository at this point in the history
We need to store cmlen instead of len in cm->cmsg_len.

Fixes: 38ebcf5 ("scm: optimize put_cmsg()")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Apr 16, 2021
1 parent 392c36e commit e7ad33f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/core/scm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e7ad33f

Please sign in to comment.