mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
[NET]: fix uaccess handling
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
28cd775273
commit
a27b58fed9
3 changed files with 25 additions and 14 deletions
|
@ -329,7 +329,7 @@ error:
|
|||
return err;
|
||||
}
|
||||
|
||||
static void raw_probe_proto_opt(struct flowi *fl, struct msghdr *msg)
|
||||
static int raw_probe_proto_opt(struct flowi *fl, struct msghdr *msg)
|
||||
{
|
||||
struct iovec *iov;
|
||||
u8 __user *type = NULL;
|
||||
|
@ -338,7 +338,7 @@ static void raw_probe_proto_opt(struct flowi *fl, struct msghdr *msg)
|
|||
unsigned int i;
|
||||
|
||||
if (!msg->msg_iov)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < msg->msg_iovlen; i++) {
|
||||
iov = &msg->msg_iov[i];
|
||||
|
@ -360,8 +360,9 @@ static void raw_probe_proto_opt(struct flowi *fl, struct msghdr *msg)
|
|||
code = iov->iov_base;
|
||||
|
||||
if (type && code) {
|
||||
get_user(fl->fl_icmp_type, type);
|
||||
get_user(fl->fl_icmp_code, code);
|
||||
if (get_user(fl->fl_icmp_type, type) ||
|
||||
get_user(fl->fl_icmp_code, code))
|
||||
return -EFAULT;
|
||||
probed = 1;
|
||||
}
|
||||
break;
|
||||
|
@ -372,6 +373,7 @@ static void raw_probe_proto_opt(struct flowi *fl, struct msghdr *msg)
|
|||
if (probed)
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
|
||||
|
@ -480,8 +482,11 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
|
|||
.proto = inet->hdrincl ? IPPROTO_RAW :
|
||||
sk->sk_protocol,
|
||||
};
|
||||
if (!inet->hdrincl)
|
||||
raw_probe_proto_opt(&fl, msg);
|
||||
if (!inet->hdrincl) {
|
||||
err = raw_probe_proto_opt(&fl, msg);
|
||||
if (err)
|
||||
goto done;
|
||||
}
|
||||
|
||||
security_sk_classify_flow(sk, &fl);
|
||||
err = ip_route_output_flow(&rt, &fl, sk, !(msg->msg_flags&MSG_DONTWAIT));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue