+ mm-maccessc-actually-return-efault-from-strncpy_from_unsafe.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: mm/maccess.c: actually return -EFAULT from strncpy_from_unsafe
has been added to the -mm tree.  Its filename is
     mm-maccessc-actually-return-efault-from-strncpy_from_unsafe.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/mm-maccessc-actually-return-efault-from-strncpy_from_unsafe.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/mm-maccessc-actually-return-efault-from-strncpy_from_unsafe.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
Subject: mm/maccess.c: actually return -EFAULT from strncpy_from_unsafe

As far as I can tell, strncpy_from_unsafe never returns -EFAULT.  ret is
the result of a __copy_from_user_inatomic(), which is 0 for success and
positive (in this case necessarily 1) for access error - it is never
negative.  So we were always returning the length of the, possibly
truncated, destination string.

Signed-off-by: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
Acked-by: Alexei Starovoitov <ast@xxxxxxxxxx>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@xxxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/maccess.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN mm/maccess.c~mm-maccessc-actually-return-efault-from-strncpy_from_unsafe mm/maccess.c
--- a/mm/maccess.c~mm-maccessc-actually-return-efault-from-strncpy_from_unsafe
+++ a/mm/maccess.c
@@ -104,5 +104,5 @@ long strncpy_from_unsafe(char *dst, cons
 	pagefault_enable();
 	set_fs(old_fs);
 
-	return ret < 0 ? ret : src - unsafe_addr;
+	return ret ? -EFAULT : src - unsafe_addr;
 }
_

Patches currently in -mm which might be from linux@xxxxxxxxxxxxxxxxxx are

compilerh-add-support-for-function-attribute-assume_aligned.patch
include-linux-compiler-gcch-hide-assume_aligned-attribute-from-sparse.patch
slabh-sprinkle-__assume_aligned-attributes.patch
mm-maccessc-actually-return-efault-from-strncpy_from_unsafe.patch
lib-dynamic_debugc-use-kstrdup_const.patch
lib-vsprintfc-handle-invalid-format-specifiers-more-robustly.patch
lib-vsprintfc-also-improve-sanity-check-in-bstr_printf.patch
lib-vsprintfc-remove-special-handling-in-pointer.patch
test_printf-test-printf-family-at-runtime.patch
lib-vsprintfc-update-documentation.patch
lib-introduce-kvasprintf_const.patch
kobject-use-kvasprintf_const-for-formatting-name.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux