Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
25f13053
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
158
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
25f13053
编写于
8月 09, 2005
作者:
L
Linus Torvalds
浏览文件
操作
浏览文件
下载
差异文件
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
上级
db29e85a
d64d3873
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
120 addition
and
84 deletion
+120
-84
arch/sparc64/solaris/socket.c
arch/sparc64/solaris/socket.c
+119
-74
net/compat.c
net/compat.c
+0
-9
net/sunrpc/svcsock.c
net/sunrpc/svcsock.c
+1
-1
未找到文件。
arch/sparc64/solaris/socket.c
浏览文件 @
25f13053
...
...
@@ -16,6 +16,7 @@
#include <linux/net.h>
#include <linux/compat.h>
#include <net/compat.h>
#include <net/sock.h>
#include <asm/uaccess.h>
#include <asm/string.h>
...
...
@@ -297,121 +298,165 @@ asmlinkage int solaris_sendmsg(int fd, struct sol_nmsghdr __user *user_msg, unsi
{
struct
socket
*
sock
;
char
address
[
MAX_SOCK_ADDR
];
struct
iovec
iov
[
UIO_FASTIOV
]
;
struct
iovec
iov
stack
[
UIO_FASTIOV
],
*
iov
=
iovstack
;
unsigned
char
ctl
[
sizeof
(
struct
cmsghdr
)
+
20
];
unsigned
char
*
ctl_buf
=
ctl
;
struct
msghdr
kern_msg
;
int
err
,
total_len
;
struct
msghdr
msg_sys
;
int
err
,
ctl_len
,
iov_size
,
total_len
;
if
(
msghdr_from_user32_to_kern
(
&
kern_msg
,
user_msg
))
return
-
EFAULT
;
if
(
kern_msg
.
msg_iovlen
>
UIO_MAXIOV
)
return
-
EINVAL
;
err
=
verify_compat_iovec
(
&
kern_msg
,
iov
,
address
,
VERIFY_READ
);
if
(
err
<
0
)
err
=
-
EFAULT
;
if
(
msghdr_from_user32_to_kern
(
&
msg_sys
,
user_msg
))
goto
out
;
sock
=
sockfd_lookup
(
fd
,
&
err
);
if
(
!
sock
)
goto
out
;
/* do not move before msg_sys is valid */
err
=
-
EMSGSIZE
;
if
(
msg_sys
.
msg_iovlen
>
UIO_MAXIOV
)
goto
out_put
;
/* Check whether to allocate the iovec area*/
err
=
-
ENOMEM
;
iov_size
=
msg_sys
.
msg_iovlen
*
sizeof
(
struct
iovec
);
if
(
msg_sys
.
msg_iovlen
>
UIO_FASTIOV
)
{
iov
=
sock_kmalloc
(
sock
->
sk
,
iov_size
,
GFP_KERNEL
);
if
(
!
iov
)
goto
out_put
;
}
err
=
verify_compat_iovec
(
&
msg_sys
,
iov
,
address
,
VERIFY_READ
);
if
(
err
<
0
)
goto
out_freeiov
;
total_len
=
err
;
if
(
kern_msg
.
msg_controllen
)
{
struct
sol_cmsghdr
__user
*
ucmsg
=
kern_msg
.
msg_control
;
err
=
-
ENOBUFS
;
if
(
msg_sys
.
msg_controllen
>
INT_MAX
)
goto
out_freeiov
;
ctl_len
=
msg_sys
.
msg_controllen
;
if
(
ctl_len
)
{
struct
sol_cmsghdr
__user
*
ucmsg
=
msg_sys
.
msg_control
;
unsigned
long
*
kcmsg
;
compat_size_t
cmlen
;
if
(
kern_msg
.
msg_controllen
<=
sizeof
(
compat_size_t
))
return
-
EINVAL
;
err
=
-
EINVAL
;
if
(
ctl_len
<=
sizeof
(
compat_size_t
))
goto
out_freeiov
;
if
(
kern_msg
.
msg_control
len
>
sizeof
(
ctl
))
{
if
(
ctl_
len
>
sizeof
(
ctl
))
{
err
=
-
ENOBUFS
;
ctl_buf
=
kmalloc
(
kern_msg
.
msg_control
len
,
GFP_KERNEL
);
if
(
!
ctl_buf
)
ctl_buf
=
kmalloc
(
ctl_
len
,
GFP_KERNEL
);
if
(
!
ctl_buf
)
goto
out_freeiov
;
}
__get_user
(
cmlen
,
&
ucmsg
->
cmsg_len
);
kcmsg
=
(
unsigned
long
*
)
ctl_buf
;
*
kcmsg
++
=
(
unsigned
long
)
cmlen
;
err
=
-
EFAULT
;
if
(
copy_from_user
(
kcmsg
,
&
ucmsg
->
cmsg_level
,
kern_msg
.
msg_control
len
-
sizeof
(
compat_size_t
)))
if
(
copy_from_user
(
kcmsg
,
&
ucmsg
->
cmsg_level
,
ctl_
len
-
sizeof
(
compat_size_t
)))
goto
out_freectl
;
kern_msg
.
msg_control
=
ctl_buf
;
msg_sys
.
msg_control
=
ctl_buf
;
}
kern_msg
.
msg_flags
=
solaris_to_linux_msgflags
(
user_flags
);
msg_sys
.
msg_flags
=
solaris_to_linux_msgflags
(
user_flags
);
lock_kernel
();
sock
=
sockfd_lookup
(
fd
,
&
err
);
if
(
sock
!=
NULL
)
{
if
(
sock
->
file
->
f_flags
&
O_NONBLOCK
)
kern_msg
.
msg_flags
|=
MSG_DONTWAIT
;
err
=
sock_sendmsg
(
sock
,
&
kern_msg
,
total_len
);
sockfd_put
(
sock
);
}
unlock_kernel
();
if
(
sock
->
file
->
f_flags
&
O_NONBLOCK
)
msg_sys
.
msg_flags
|=
MSG_DONTWAIT
;
err
=
sock_sendmsg
(
sock
,
&
msg_sys
,
total_len
);
out_freectl:
/* N.B. Use kfree here, as kern_msg.msg_controllen might change? */
if
(
ctl_buf
!=
ctl
)
kfree
(
ctl_buf
);
if
(
ctl_buf
!=
ctl
)
sock_kfree_s
(
sock
->
sk
,
ctl_buf
,
ctl_len
);
out_freeiov:
if
(
kern_msg
.
msg_iov
!=
iov
)
kfree
(
kern_msg
.
msg_iov
);
out:
if
(
iov
!=
iovstack
)
sock_kfree_s
(
sock
->
sk
,
iov
,
iov_size
);
out_put:
sockfd_put
(
sock
);
out:
return
err
;
}
asmlinkage
int
solaris_recvmsg
(
int
fd
,
struct
sol_nmsghdr
__user
*
user_msg
,
unsigned
int
user_flags
)
{
struct
iovec
iovstack
[
UIO_FASTIOV
];
struct
msghdr
kern_msg
;
char
addr
[
MAX_SOCK_ADDR
];
struct
socket
*
sock
;
struct
iovec
iovstack
[
UIO_FASTIOV
];
struct
iovec
*
iov
=
iovstack
;
struct
msghdr
msg_sys
;
unsigned
long
cmsg_ptr
;
int
err
,
iov_size
,
total_len
,
len
;
/* kernel mode address */
char
addr
[
MAX_SOCK_ADDR
];
/* user mode address pointers */
struct
sockaddr
__user
*
uaddr
;
int
__user
*
uaddr_len
;
unsigned
long
cmsg_ptr
;
int
err
,
total_len
,
len
=
0
;
if
(
msghdr_from_user32_to_kern
(
&
kern_msg
,
user_msg
))
if
(
msghdr_from_user32_to_kern
(
&
msg_sys
,
user_msg
))
return
-
EFAULT
;
if
(
kern_msg
.
msg_iovlen
>
UIO_MAXIOV
)
return
-
EINVAL
;
uaddr
=
kern_msg
.
msg_name
;
sock
=
sockfd_lookup
(
fd
,
&
err
);
if
(
!
sock
)
goto
out
;
err
=
-
EMSGSIZE
;
if
(
msg_sys
.
msg_iovlen
>
UIO_MAXIOV
)
goto
out_put
;
/* Check whether to allocate the iovec area*/
err
=
-
ENOMEM
;
iov_size
=
msg_sys
.
msg_iovlen
*
sizeof
(
struct
iovec
);
if
(
msg_sys
.
msg_iovlen
>
UIO_FASTIOV
)
{
iov
=
sock_kmalloc
(
sock
->
sk
,
iov_size
,
GFP_KERNEL
);
if
(
!
iov
)
goto
out_put
;
}
/*
* Save the user-mode address (verify_iovec will change the
* kernel msghdr to use the kernel address space)
*/
uaddr
=
(
void
__user
*
)
msg_sys
.
msg_name
;
uaddr_len
=
&
user_msg
->
msg_namelen
;
err
=
verify_compat_iovec
(
&
kern_msg
,
iov
,
addr
,
VERIFY_WRITE
);
err
=
verify_compat_iovec
(
&
msg_sys
,
iov
,
addr
,
VERIFY_WRITE
);
if
(
err
<
0
)
goto
out
;
goto
out
_freeiov
;
total_len
=
err
;
cmsg_ptr
=
(
unsigned
long
)
kern_msg
.
msg_control
;
kern_msg
.
msg_flags
=
0
;
cmsg_ptr
=
(
unsigned
long
)
msg_sys
.
msg_control
;
msg_sys
.
msg_flags
=
MSG_CMSG_COMPAT
;
lock_kernel
();
sock
=
sockfd_lookup
(
fd
,
&
err
);
if
(
sock
!=
NULL
)
{
if
(
sock
->
file
->
f_flags
&
O_NONBLOCK
)
user_flags
|=
MSG_DONTWAIT
;
err
=
sock_recvmsg
(
sock
,
&
kern_msg
,
total_len
,
user_flags
);
if
(
err
>=
0
)
len
=
err
;
sockfd_put
(
sock
);
}
unlock_kernel
();
if
(
uaddr
!=
NULL
&&
err
>=
0
)
err
=
move_addr_to_user
(
addr
,
kern_msg
.
msg_namelen
,
uaddr
,
uaddr_len
);
if
(
err
>=
0
)
{
err
=
__put_user
(
linux_to_solaris_msgflags
(
kern_msg
.
msg_flags
),
&
user_msg
->
msg_flags
);
if
(
!
err
)
{
/* XXX Convert cmsg back into userspace 32-bit format... */
err
=
__put_user
((
unsigned
long
)
kern_msg
.
msg_control
-
cmsg_ptr
,
&
user_msg
->
msg_controllen
);
}
if
(
sock
->
file
->
f_flags
&
O_NONBLOCK
)
user_flags
|=
MSG_DONTWAIT
;
err
=
sock_recvmsg
(
sock
,
&
msg_sys
,
total_len
,
user_flags
);
if
(
err
<
0
)
goto
out_freeiov
;
len
=
err
;
if
(
uaddr
!=
NULL
)
{
err
=
move_addr_to_user
(
addr
,
msg_sys
.
msg_namelen
,
uaddr
,
uaddr_len
);
if
(
err
<
0
)
goto
out_freeiov
;
}
err
=
__put_user
(
linux_to_solaris_msgflags
(
msg_sys
.
msg_flags
),
&
user_msg
->
msg_flags
);
if
(
err
)
goto
out_freeiov
;
err
=
__put_user
((
unsigned
long
)
msg_sys
.
msg_control
-
cmsg_ptr
,
&
user_msg
->
msg_controllen
);
if
(
err
)
goto
out_freeiov
;
err
=
len
;
if
(
kern_msg
.
msg_iov
!=
iov
)
kfree
(
kern_msg
.
msg_iov
);
out_freeiov:
if
(
iov
!=
iovstack
)
sock_kfree_s
(
sock
->
sk
,
iov
,
iov_size
);
out_put:
sockfd_put
(
sock
);
out:
if
(
err
<
0
)
return
err
;
return
len
;
return
err
;
}
net/compat.c
浏览文件 @
25f13053
...
...
@@ -91,20 +91,11 @@ int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov,
}
else
kern_msg
->
msg_name
=
NULL
;
if
(
kern_msg
->
msg_iovlen
>
UIO_FASTIOV
)
{
kern_iov
=
kmalloc
(
kern_msg
->
msg_iovlen
*
sizeof
(
struct
iovec
),
GFP_KERNEL
);
if
(
!
kern_iov
)
return
-
ENOMEM
;
}
tot_len
=
iov_from_user_compat_to_kern
(
kern_iov
,
(
struct
compat_iovec
__user
*
)
kern_msg
->
msg_iov
,
kern_msg
->
msg_iovlen
);
if
(
tot_len
>=
0
)
kern_msg
->
msg_iov
=
kern_iov
;
else
if
(
kern_msg
->
msg_iovlen
>
UIO_FASTIOV
)
kfree
(
kern_iov
);
return
tot_len
;
}
...
...
net/sunrpc/svcsock.c
浏览文件 @
25f13053
...
...
@@ -586,7 +586,7 @@ svc_udp_recvfrom(struct svc_rqst *rqstp)
}
if
(
skb
->
stamp
.
tv_sec
==
0
)
{
skb
->
stamp
.
tv_sec
=
xtime
.
tv_sec
;
skb
->
stamp
.
tv_usec
=
xtime
.
tv_nsec
*
1000
;
skb
->
stamp
.
tv_usec
=
xtime
.
tv_nsec
/
NSEC_PER_USEC
;
/* Don't enable netstamp, sunrpc doesn't
need that much accuracy */
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录