diff options
| author | Paolo Abeni <pabeni@redhat.com> | 2024-11-28 08:57:42 +0100 |
|---|---|---|
| committer | Paolo Abeni <pabeni@redhat.com> | 2024-11-28 08:57:42 +0100 |
| commit | d1524d040b12e5bee1ee1d04ce50122a1ea35258 (patch) | |
| tree | 60dc45d6d52ff90178d5b51b5824531dd454d011 /include/linux | |
| parent | 5dfd7d940094e1a1ec974d90f6d28162d372b56b (diff) | |
| parent | 49b2b973325add467270e906d4d794aa6679b38b (diff) | |
Merge branch 'net-fix-some-callers-of-copy_from_sockptr'
Michal Luczaj says:
====================
net: Fix some callers of copy_from_sockptr()
Some callers misinterpret copy_from_sockptr()'s return value. The function
follows copy_from_user(), i.e. returns 0 for success, or the number of
bytes not copied on error. Simply returning the result in a non-zero case
isn't usually what was intended.
Compile tested with CONFIG_LLC, CONFIG_AF_RXRPC, CONFIG_BT enabled.
Last patch probably belongs more to net-next, if any. Here as an RFC.
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Michal Luczaj <mhal@rbox.co>
====================
Link: https://patch.msgid.link/20241119-sockptr-copy-fixes-v3-0-d752cac4be8e@rbox.co
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/sockptr.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/sockptr.h b/include/linux/sockptr.h index 195debe2b1db..3e6c8e9d67ae 100644 --- a/include/linux/sockptr.h +++ b/include/linux/sockptr.h @@ -53,6 +53,8 @@ static inline int copy_from_sockptr_offset(void *dst, sockptr_t src, /* Deprecated. * This is unsafe, unless caller checked user provided optlen. * Prefer copy_safe_from_sockptr() instead. + * + * Returns 0 for success, or number of bytes not copied on error. */ static inline int copy_from_sockptr(void *dst, sockptr_t src, size_t size) { |
