Skip to content

Commit 449cd5d

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull misc fixes from Al Viro: "A couple of regression fixes, one for this merge window, one for the previous cycle" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: ipc/shm: Fix order of parameters when calling copy_compat_shmid_to_user iov_iter: fix page_copy_sane for compound pages
2 parents d9fde26 + 58aff0a commit 449cd5d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

ipc/shm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@ COMPAT_SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, void __user *, uptr)
12371237
err = shmctl_stat(ns, shmid, cmd, &sem64);
12381238
if (err < 0)
12391239
return err;
1240-
if (copy_compat_shmid_to_user(&sem64, uptr, version))
1240+
if (copy_compat_shmid_to_user(uptr, &sem64, version))
12411241
err = -EFAULT;
12421242
return err;
12431243

lib/iov_iter.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,8 +687,10 @@ EXPORT_SYMBOL(_copy_from_iter_full_nocache);
687687

688688
static inline bool page_copy_sane(struct page *page, size_t offset, size_t n)
689689
{
690-
size_t v = n + offset;
691-
if (likely(n <= v && v <= (PAGE_SIZE << compound_order(page))))
690+
struct page *head = compound_head(page);
691+
size_t v = n + offset + page_address(page) - page_address(head);
692+
693+
if (likely(n <= v && v <= (PAGE_SIZE << compound_order(head))))
692694
return true;
693695
WARN_ON(1);
694696
return false;

0 commit comments

Comments
 (0)