iscsi-scst: Port to Linux kernel v5.9 (merge r9149 from trunk)

git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.4.x@9203 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2020-12-03 03:35:19 +00:00
parent 7caab58196
commit e9d91d5df3
3 changed files with 12 additions and 2 deletions

View File

@@ -789,7 +789,7 @@ static int conn_setup_sock(struct iscsi_conn *conn)
oldfs = get_fs();
set_fs(KERNEL_DS);
conn->sock->ops->setsockopt(conn->sock, SOL_TCP, TCP_NODELAY,
(void __force __user *)&opt, sizeof(opt));
KERNEL_SOCKPTR(&opt), sizeof(opt));
set_fs(oldfs);
out:

View File

@@ -2890,7 +2890,7 @@ static inline void set_cork(struct socket *sock, int on)
oldfs = get_fs();
set_fs(KERNEL_DS);
sock->ops->setsockopt(sock, SOL_TCP, TCP_CORK,
(void __force __user *)&opt, sizeof(opt));
KERNEL_SOCKPTR(&opt), sizeof(opt));
set_fs(oldfs);
return;
}

View File

@@ -1452,6 +1452,16 @@ static inline struct kmem_cache *kmem_cache_create_usercopy(const char *name,
sizeof_field(struct __struct, __field), NULL)
#endif
/* <linux/sockptr.h> */
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)
/* See also commit ba423fdaa589 ("net: add a new sockptr_t type") # v5.9 */
static inline void __user *KERNEL_SOCKPTR(void *p)
{
return (void __force __user *)p;
}
#endif
/* <linux/stddef.h> */
#ifndef sizeof_field