Commit 7800007c1e2d42cd4120b87b0ba3f3480f17f30a
Committed by
David S. Miller
1 parent
7582e9d17e
Exists in
master
and in
39 other branches
[NETFILTER]: x_tables: don't use __copy_{from,to}_user on unchecked memory in compat layer
Noticed by Linus Torvalds <torvalds@osdl.org> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 2 changed files with 5 additions and 5 deletions Side-by-side Diff
net/ipv4/netfilter/ip_tables.c
... | ... | @@ -1441,7 +1441,7 @@ |
1441 | 1441 | ret = -EFAULT; |
1442 | 1442 | origsize = *size; |
1443 | 1443 | ce = (struct compat_ipt_entry __user *)*dstptr; |
1444 | - if (__copy_to_user(ce, e, sizeof(struct ipt_entry))) | |
1444 | + if (copy_to_user(ce, e, sizeof(struct ipt_entry))) | |
1445 | 1445 | goto out; |
1446 | 1446 | |
1447 | 1447 | *dstptr += sizeof(struct compat_ipt_entry); |
1448 | 1448 | |
... | ... | @@ -1459,9 +1459,9 @@ |
1459 | 1459 | goto out; |
1460 | 1460 | ret = -EFAULT; |
1461 | 1461 | next_offset = e->next_offset - (origsize - *size); |
1462 | - if (__put_user(target_offset, &ce->target_offset)) | |
1462 | + if (put_user(target_offset, &ce->target_offset)) | |
1463 | 1463 | goto out; |
1464 | - if (__put_user(next_offset, &ce->next_offset)) | |
1464 | + if (put_user(next_offset, &ce->next_offset)) | |
1465 | 1465 | goto out; |
1466 | 1466 | return 0; |
1467 | 1467 | out: |
net/netfilter/x_tables.c
... | ... | @@ -289,7 +289,7 @@ |
289 | 289 | case COMPAT_TO_USER: |
290 | 290 | pm = (struct xt_entry_match *)match; |
291 | 291 | msize = pm->u.user.match_size; |
292 | - if (__copy_to_user(*dstptr, pm, msize)) { | |
292 | + if (copy_to_user(*dstptr, pm, msize)) { | |
293 | 293 | ret = -EFAULT; |
294 | 294 | break; |
295 | 295 | } |
... | ... | @@ -366,7 +366,7 @@ |
366 | 366 | case COMPAT_TO_USER: |
367 | 367 | pt = (struct xt_entry_target *)target; |
368 | 368 | tsize = pt->u.user.target_size; |
369 | - if (__copy_to_user(*dstptr, pt, tsize)) { | |
369 | + if (copy_to_user(*dstptr, pt, tsize)) { | |
370 | 370 | ret = -EFAULT; |
371 | 371 | break; |
372 | 372 | } |