diff options
Diffstat (limited to 'net/compat.c')
-rw-r--r-- | net/compat.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/net/compat.c b/net/compat.c index 9a76eaf63184..bc8aeefddf3f 100644 --- a/net/compat.c +++ b/net/compat.c | |||
@@ -85,7 +85,7 @@ int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov, | |||
85 | { | 85 | { |
86 | int tot_len; | 86 | int tot_len; |
87 | 87 | ||
88 | if (kern_msg->msg_namelen) { | 88 | if (kern_msg->msg_name && kern_msg->msg_namelen) { |
89 | if (mode == VERIFY_READ) { | 89 | if (mode == VERIFY_READ) { |
90 | int err = move_addr_to_kernel(kern_msg->msg_name, | 90 | int err = move_addr_to_kernel(kern_msg->msg_name, |
91 | kern_msg->msg_namelen, | 91 | kern_msg->msg_namelen, |
@@ -93,10 +93,11 @@ int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov, | |||
93 | if (err < 0) | 93 | if (err < 0) |
94 | return err; | 94 | return err; |
95 | } | 95 | } |
96 | if (kern_msg->msg_name) | 96 | kern_msg->msg_name = kern_address; |
97 | kern_msg->msg_name = kern_address; | 97 | } else { |
98 | } else | ||
99 | kern_msg->msg_name = NULL; | 98 | kern_msg->msg_name = NULL; |
99 | kern_msg->msg_namelen = 0; | ||
100 | } | ||
100 | 101 | ||
101 | tot_len = iov_from_user_compat_to_kern(kern_iov, | 102 | tot_len = iov_from_user_compat_to_kern(kern_iov, |
102 | (struct compat_iovec __user *)kern_msg->msg_iov, | 103 | (struct compat_iovec __user *)kern_msg->msg_iov, |