]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.18-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 Apr 2019 09:08:40 +0000 (11:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 Apr 2019 09:08:40 +0000 (11:08 +0200)
added patches:
string-drop-__must_check-from-strscpy-and-restore-strscpy-usages-in-cgroup.patch

queue-3.18/qmi_wwan-add-olicard-600.patch
queue-3.18/series
queue-3.18/string-drop-__must_check-from-strscpy-and-restore-strscpy-usages-in-cgroup.patch [new file with mode: 0644]

index ba26cb100327471e2c2364f311679c19e34e612c..cc1f57e377695e1bed9c477970332abd391ea9c8 100644 (file)
@@ -1,9 +1,9 @@
 From foo@baz Mon Apr 15 10:13:34 CEST 2019
-From: "Bjørn Mork" <bjorn@mork.no>
+From: Bjørn Mork <bjorn@mork.no>
 Date: Wed, 27 Mar 2019 15:26:01 +0100
 Subject: qmi_wwan: add Olicard 600
 
-From: "Bjørn Mork" <bjorn@mork.no>
+From: Bjørn Mork <bjorn@mork.no>
 
 [ Upstream commit 6289d0facd9ebce4cc83e5da39e15643ee998dc5 ]
 
index 1f69af5afae514d277fc72f4c20879fe45e84f2a..9eacf6a79aedd346663dc0068324c9f52404d60b 100644 (file)
@@ -57,3 +57,4 @@ xen-prevent-buffer-overflow-in-privcmd-ioctl.patch
 sched-fair-do-not-re-read-h_load_next-during-hierarchical-load-calculation.patch
 xtensa-fix-return_address.patch
 pci-add-function-1-dma-alias-quirk-for-marvell-9170-sata-controller.patch
+string-drop-__must_check-from-strscpy-and-restore-strscpy-usages-in-cgroup.patch
diff --git a/queue-3.18/string-drop-__must_check-from-strscpy-and-restore-strscpy-usages-in-cgroup.patch b/queue-3.18/string-drop-__must_check-from-strscpy-and-restore-strscpy-usages-in-cgroup.patch
new file mode 100644 (file)
index 0000000..d5b49c6
--- /dev/null
@@ -0,0 +1,65 @@
+From a7ea4de3664593a4d79cb7e62e3c8736cabb5d3c Mon Sep 17 00:00:00 2001
+From: Tejun Heo <tj@kernel.org>
+Date: Tue, 9 Jan 2018 07:21:15 -0800
+Subject: string: drop __must_check from strscpy() and restore strscpy() usages in cgroup
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Tejun Heo <tj@kernel.org>
+
+commit 08a77676f9c5fc69a681ccd2cd8140e65dcb26c7 upstream.
+
+e7fd37ba1217 ("cgroup: avoid copying strings longer than the buffers")
+converted possibly unsafe strncpy() usages in cgroup to strscpy().
+However, although the callsites are completely fine with truncated
+copied, because strscpy() is marked __must_check, it led to the
+following warnings.
+
+  kernel/cgroup/cgroup.c: In function ‘cgroup_file_name’:
+  kernel/cgroup/cgroup.c:1400:10: warning: ignoring return value of ‘strscpy’, declared with attribute warn_unused_result [-Wunused-result]
+     strscpy(buf, cft->name, CGROUP_FILE_NAME_MAX);
+              ^
+
+To avoid the warnings, 50034ed49645 ("cgroup: use strlcpy() instead of
+strscpy() to avoid spurious warning") switched them to strlcpy().
+
+strlcpy() is worse than strlcpy() because it unconditionally runs
+strlen() on the source string, and the only reason we switched to
+strlcpy() here was because it was lacking __must_check, which doesn't
+reflect any material differences between the two function.  It's just
+that someone added __must_check to strscpy() and not to strlcpy().
+
+These basic string copy operations are used in variety of ways, and
+one of not-so-uncommon use cases is safely handling truncated copies,
+where the caller naturally doesn't care about the return value.  The
+__must_check doesn't match the actual use cases and forces users to
+opt for inferior variants which lack __must_check by happenstance or
+spread ugly (void) casts.
+
+Remove __must_check from strscpy() and restore strscpy() usages in
+cgroup.
+
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
+Cc: Arnd Bergmann <arnd@arndb.de>
+Cc: Chris Metcalf <cmetcalf@ezchip.com>
+[backport only the string.h portion to remove build warnings starting to show up - gregkh]
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/string.h |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/include/linux/string.h
++++ b/include/linux/string.h
+@@ -26,7 +26,7 @@ extern char * strncpy(char *,const char
+ size_t strlcpy(char *, const char *, size_t);
+ #endif
+ #ifndef __HAVE_ARCH_STRSCPY
+-ssize_t __must_check strscpy(char *, const char *, size_t);
++ssize_t strscpy(char *, const char *, size_t);
+ #endif
+ #ifndef __HAVE_ARCH_STRCAT
+ extern char * strcat(char *, const char *);