Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
25f13053
Commit
25f13053
authored
Aug 09, 2005
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
parents
db29e85a
d64d3873
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
120 additions
and
84 deletions
+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
No files found.
arch/sparc64/solaris/socket.c
View file @
25f13053
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#include <linux/net.h>
#include <linux/net.h>
#include <linux/compat.h>
#include <linux/compat.h>
#include <net/compat.h>
#include <net/compat.h>
#include <net/sock.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include <asm/string.h>
#include <asm/string.h>
...
@@ -297,121 +298,165 @@ asmlinkage int solaris_sendmsg(int fd, struct sol_nmsghdr __user *user_msg, unsi
...
@@ -297,121 +298,165 @@ asmlinkage int solaris_sendmsg(int fd, struct sol_nmsghdr __user *user_msg, unsi
{
{
struct
socket
*
sock
;
struct
socket
*
sock
;
char
address
[
MAX_SOCK_ADDR
];
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
[
sizeof
(
struct
cmsghdr
)
+
20
];
unsigned
char
*
ctl_buf
=
ctl
;
unsigned
char
*
ctl_buf
=
ctl
;
struct
msghdr
kern_msg
;
struct
msghdr
msg_sys
;
int
err
,
total_len
;
int
err
,
ctl_len
,
iov_size
,
total_len
;
if
(
msghdr_from_user32_to_kern
(
&
kern_msg
,
user_msg
))
err
=
-
EFAULT
;
return
-
EFAULT
;
if
(
msghdr_from_user32_to_kern
(
&
msg_sys
,
user_msg
))
if
(
kern_msg
.
msg_iovlen
>
UIO_MAXIOV
)
goto
out
;
return
-
EINVAL
;
err
=
verify_compat_iovec
(
&
kern_msg
,
iov
,
address
,
VERIFY_READ
);
sock
=
sockfd_lookup
(
fd
,
&
err
);
if
(
err
<
0
)
if
(
!
sock
)
goto
out
;
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
;
total_len
=
err
;
if
(
kern_msg
.
msg_controllen
)
{
err
=
-
ENOBUFS
;
struct
sol_cmsghdr
__user
*
ucmsg
=
kern_msg
.
msg_control
;
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
;
unsigned
long
*
kcmsg
;
compat_size_t
cmlen
;
compat_size_t
cmlen
;
if
(
kern_msg
.
msg_controllen
<=
sizeof
(
compat_size_t
))
err
=
-
EINVAL
;
return
-
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
;
err
=
-
ENOBUFS
;
ctl_buf
=
kmalloc
(
kern_msg
.
msg_control
len
,
GFP_KERNEL
);
ctl_buf
=
kmalloc
(
ctl_
len
,
GFP_KERNEL
);
if
(
!
ctl_buf
)
if
(
!
ctl_buf
)
goto
out_freeiov
;
goto
out_freeiov
;
}
}
__get_user
(
cmlen
,
&
ucmsg
->
cmsg_len
);
__get_user
(
cmlen
,
&
ucmsg
->
cmsg_len
);
kcmsg
=
(
unsigned
long
*
)
ctl_buf
;
kcmsg
=
(
unsigned
long
*
)
ctl_buf
;
*
kcmsg
++
=
(
unsigned
long
)
cmlen
;
*
kcmsg
++
=
(
unsigned
long
)
cmlen
;
err
=
-
EFAULT
;
err
=
-
EFAULT
;
if
(
copy_from_user
(
kcmsg
,
&
ucmsg
->
cmsg_level
,
if
(
copy_from_user
(
kcmsg
,
&
ucmsg
->
cmsg_level
,
kern_msg
.
msg_control
len
-
sizeof
(
compat_size_t
)))
ctl_
len
-
sizeof
(
compat_size_t
)))
goto
out_freectl
;
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
();
if
(
sock
->
file
->
f_flags
&
O_NONBLOCK
)
sock
=
sockfd_lookup
(
fd
,
&
err
);
msg_sys
.
msg_flags
|=
MSG_DONTWAIT
;
if
(
sock
!=
NULL
)
{
err
=
sock_sendmsg
(
sock
,
&
msg_sys
,
total_len
);
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
();
out_freectl:
out_freectl:
/* N.B. Use kfree here, as kern_msg.msg_controllen might change? */
if
(
ctl_buf
!=
ctl
)
if
(
ctl_buf
!=
ctl
)
sock_kfree_s
(
sock
->
sk
,
ctl_buf
,
ctl_len
);
kfree
(
ctl_buf
);
out_freeiov:
out_freeiov:
if
(
kern_msg
.
msg_iov
!=
iov
)
if
(
iov
!=
iovstack
)
kfree
(
kern_msg
.
msg_iov
);
sock_kfree_s
(
sock
->
sk
,
iov
,
iov_size
);
out:
out_put:
sockfd_put
(
sock
);
out:
return
err
;
return
err
;
}
}
asmlinkage
int
solaris_recvmsg
(
int
fd
,
struct
sol_nmsghdr
__user
*
user_msg
,
unsigned
int
user_flags
)
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
socket
*
sock
;
struct
iovec
iovstack
[
UIO_FASTIOV
];
struct
iovec
*
iov
=
iovstack
;
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
;
struct
sockaddr
__user
*
uaddr
;
int
__user
*
uaddr_len
;
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
;
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
;
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
)
if
(
err
<
0
)
goto
out
;
goto
out
_freeiov
;
total_len
=
err
;
total_len
=
err
;
cmsg_ptr
=
(
unsigned
long
)
kern_msg
.
msg_control
;
cmsg_ptr
=
(
unsigned
long
)
msg_sys
.
msg_control
;
kern_msg
.
msg_flags
=
0
;
msg_sys
.
msg_flags
=
MSG_CMSG_COMPAT
;
lock_kernel
();
if
(
sock
->
file
->
f_flags
&
O_NONBLOCK
)
sock
=
sockfd_lookup
(
fd
,
&
err
);
user_flags
|=
MSG_DONTWAIT
;
if
(
sock
!=
NULL
)
{
if
(
sock
->
file
->
f_flags
&
O_NONBLOCK
)
err
=
sock_recvmsg
(
sock
,
&
msg_sys
,
total_len
,
user_flags
);
user_flags
|=
MSG_DONTWAIT
;
if
(
err
<
0
)
err
=
sock_recvmsg
(
sock
,
&
kern_msg
,
total_len
,
user_flags
);
goto
out_freeiov
;
if
(
err
>=
0
)
len
=
err
;
len
=
err
;
sockfd_put
(
sock
);
}
if
(
uaddr
!=
NULL
)
{
unlock_kernel
();
err
=
move_addr_to_user
(
addr
,
msg_sys
.
msg_namelen
,
uaddr
,
uaddr_len
);
if
(
err
<
0
)
if
(
uaddr
!=
NULL
&&
err
>=
0
)
goto
out_freeiov
;
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
);
}
}
}
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
)
out_freeiov:
kfree
(
kern_msg
.
msg_iov
);
if
(
iov
!=
iovstack
)
sock_kfree_s
(
sock
->
sk
,
iov
,
iov_size
);
out_put:
sockfd_put
(
sock
);
out:
out:
if
(
err
<
0
)
return
err
;
return
err
;
return
len
;
}
}
net/compat.c
View file @
25f13053
...
@@ -91,20 +91,11 @@ int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov,
...
@@ -91,20 +91,11 @@ int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov,
}
else
}
else
kern_msg
->
msg_name
=
NULL
;
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
,
tot_len
=
iov_from_user_compat_to_kern
(
kern_iov
,
(
struct
compat_iovec
__user
*
)
kern_msg
->
msg_iov
,
(
struct
compat_iovec
__user
*
)
kern_msg
->
msg_iov
,
kern_msg
->
msg_iovlen
);
kern_msg
->
msg_iovlen
);
if
(
tot_len
>=
0
)
if
(
tot_len
>=
0
)
kern_msg
->
msg_iov
=
kern_iov
;
kern_msg
->
msg_iov
=
kern_iov
;
else
if
(
kern_msg
->
msg_iovlen
>
UIO_FASTIOV
)
kfree
(
kern_iov
);
return
tot_len
;
return
tot_len
;
}
}
...
...
net/sunrpc/svcsock.c
View file @
25f13053
...
@@ -586,7 +586,7 @@ svc_udp_recvfrom(struct svc_rqst *rqstp)
...
@@ -586,7 +586,7 @@ svc_udp_recvfrom(struct svc_rqst *rqstp)
}
}
if
(
skb
->
stamp
.
tv_sec
==
0
)
{
if
(
skb
->
stamp
.
tv_sec
==
0
)
{
skb
->
stamp
.
tv_sec
=
xtime
.
tv_sec
;
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
/* Don't enable netstamp, sunrpc doesn't
need that much accuracy */
need that much accuracy */
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment