]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 3 Mar 2020 06:43:49 +0000 (07:43 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 3 Mar 2020 06:43:49 +0000 (07:43 +0100)
added patches:
ecryptfs-fix-up-bad-backport-of-fe2e082f5da5b4a0a92ae32978f81507ef37ec66.patch
usb-charger-assign-specific-number-for-enum-value.patch

queue-4.14/ecryptfs-fix-up-bad-backport-of-fe2e082f5da5b4a0a92ae32978f81507ef37ec66.patch [new file with mode: 0644]
queue-4.14/series
queue-4.14/usb-charger-assign-specific-number-for-enum-value.patch [new file with mode: 0644]

diff --git a/queue-4.14/ecryptfs-fix-up-bad-backport-of-fe2e082f5da5b4a0a92ae32978f81507ef37ec66.patch b/queue-4.14/ecryptfs-fix-up-bad-backport-of-fe2e082f5da5b4a0a92ae32978f81507ef37ec66.patch
new file mode 100644 (file)
index 0000000..fa3f366
--- /dev/null
@@ -0,0 +1,82 @@
+From natechancellor@gmail.com  Tue Mar  3 07:42:32 2020
+From: Nathan Chancellor <natechancellor@gmail.com>
+Date: Mon,  2 Mar 2020 13:39:13 -0700
+Subject: ecryptfs: Fix up bad backport of fe2e082f5da5b4a0a92ae32978f81507ef37ec66
+To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Sasha Levin <sashal@kernel.org>
+Cc: stable@vger.kernel.org, ecryptfs@vger.kernel.org, Wenwen Wang <wenwen@cs.uga.edu>, Tyler Hicks <tyhicks@canonical.com>, Nathan Chancellor <natechancellor@gmail.com>
+Message-ID: <20200302203912.27370-1-natechancellor@gmail.com>
+
+From: Nathan Chancellor <natechancellor@gmail.com>
+
+When doing the 4.9 merge into certain Android trees, I noticed a warning
+from Android's deprecated GCC 4.9.4, which causes a build failure in
+those trees due to basically -Werror:
+
+fs/ecryptfs/keystore.c: In function 'ecryptfs_parse_packet_set':
+fs/ecryptfs/keystore.c:1357:2: warning: 'auth_tok_list_item' may be used
+uninitialized in this function [-Wmaybe-uninitialized]
+  memset(auth_tok_list_item, 0,
+  ^
+fs/ecryptfs/keystore.c:1260:38: note: 'auth_tok_list_item' was declared
+here
+  struct ecryptfs_auth_tok_list_item *auth_tok_list_item;
+                                      ^
+
+GCC 9.2.0 was not able to pick up this warning when I tested it.
+
+Turns out that Clang warns as well when -Wuninitialized is used, which
+is not the case in older stable trees at the moment (but shows value in
+potentially backporting the various warning fixes currently in upstream
+to get more coverage).
+
+fs/ecryptfs/keystore.c:1284:6: warning: variable 'auth_tok_list_item' is
+used uninitialized whenever 'if' condition is true
+[-Wsometimes-uninitialized]
+        if (data[(*packet_size)++] != ECRYPTFS_TAG_1_PACKET_TYPE) {
+            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+fs/ecryptfs/keystore.c:1360:4: note: uninitialized use occurs here
+                        auth_tok_list_item);
+                        ^~~~~~~~~~~~~~~~~~
+fs/ecryptfs/keystore.c:1284:2: note: remove the 'if' if its condition is
+always false
+        if (data[(*packet_size)++] != ECRYPTFS_TAG_1_PACKET_TYPE) {
+        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+fs/ecryptfs/keystore.c:1260:56: note: initialize the variable
+'auth_tok_list_item' to silence this warning
+        struct ecryptfs_auth_tok_list_item *auth_tok_list_item;
+                                                              ^
+                                                               = NULL
+1 warning generated.
+
+Somehow, commit fe2e082f5da5 ("ecryptfs: fix a memory leak bug in
+parse_tag_1_packet()") upstream was not applied in the correct if block
+in 4.4.215, 4.9.215, and 4.14.172, which will indeed lead to use of
+uninitialized memory. Fix it up by undoing the bad backport in those
+trees then reapplying the patch in the proper location.
+
+Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/ecryptfs/keystore.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/fs/ecryptfs/keystore.c
++++ b/fs/ecryptfs/keystore.c
+@@ -1285,7 +1285,7 @@ parse_tag_1_packet(struct ecryptfs_crypt
+               printk(KERN_ERR "Enter w/ first byte != 0x%.2x\n",
+                      ECRYPTFS_TAG_1_PACKET_TYPE);
+               rc = -EINVAL;
+-              goto out_free;
++              goto out;
+       }
+       /* Released: wipe_auth_tok_list called in ecryptfs_parse_packet_set or
+        * at end of function upon failure */
+@@ -1335,7 +1335,7 @@ parse_tag_1_packet(struct ecryptfs_crypt
+               printk(KERN_WARNING "Tag 1 packet contains key larger "
+                      "than ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES");
+               rc = -EINVAL;
+-              goto out;
++              goto out_free;
+       }
+       memcpy((*new_auth_tok)->session_key.encrypted_key,
+              &data[(*packet_size)], (body_size - (ECRYPTFS_SIG_SIZE + 2)));
index 8c9520f24e7dacaa6b54e55fa77c2e86c263f1ea..71a9da7ce3a48e33af594abaa461feecb021bc2b 100644 (file)
@@ -48,3 +48,5 @@ mips-vpe-fix-a-double-free-and-a-memory-leak-in-release_vpe.patch
 i2c-altera-fix-potential-integer-overflow.patch
 i2c-jz4780-silence-log-flood-on-txabrt.patch
 drm-i915-gvt-separate-display-reset-from-all_engines-reset.patch
+usb-charger-assign-specific-number-for-enum-value.patch
+ecryptfs-fix-up-bad-backport-of-fe2e082f5da5b4a0a92ae32978f81507ef37ec66.patch
diff --git a/queue-4.14/usb-charger-assign-specific-number-for-enum-value.patch b/queue-4.14/usb-charger-assign-specific-number-for-enum-value.patch
new file mode 100644 (file)
index 0000000..7f89988
--- /dev/null
@@ -0,0 +1,51 @@
+From ca4b43c14cd88d28cfc6467d2fa075aad6818f1d Mon Sep 17 00:00:00 2001
+From: Peter Chen <peter.chen@nxp.com>
+Date: Sat, 1 Feb 2020 14:13:44 +0800
+Subject: usb: charger: assign specific number for enum value
+
+From: Peter Chen <peter.chen@nxp.com>
+
+commit ca4b43c14cd88d28cfc6467d2fa075aad6818f1d upstream.
+
+To work properly on every architectures and compilers, the enum value
+needs to be specific numbers.
+
+Suggested-by: Greg KH <gregkh@linuxfoundation.org>
+Signed-off-by: Peter Chen <peter.chen@nxp.com>
+Link: https://lore.kernel.org/r/1580537624-10179-1-git-send-email-peter.chen@nxp.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/uapi/linux/usb/charger.h |   16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+--- a/include/uapi/linux/usb/charger.h
++++ b/include/uapi/linux/usb/charger.h
+@@ -14,18 +14,18 @@
+  * ACA (Accessory Charger Adapters)
+  */
+ enum usb_charger_type {
+-      UNKNOWN_TYPE,
+-      SDP_TYPE,
+-      DCP_TYPE,
+-      CDP_TYPE,
+-      ACA_TYPE,
++      UNKNOWN_TYPE = 0,
++      SDP_TYPE = 1,
++      DCP_TYPE = 2,
++      CDP_TYPE = 3,
++      ACA_TYPE = 4,
+ };
+ /* USB charger state */
+ enum usb_charger_state {
+-      USB_CHARGER_DEFAULT,
+-      USB_CHARGER_PRESENT,
+-      USB_CHARGER_ABSENT,
++      USB_CHARGER_DEFAULT = 0,
++      USB_CHARGER_PRESENT = 1,
++      USB_CHARGER_ABSENT = 2,
+ };
+ #endif /* _UAPI__LINUX_USB_CHARGER_H */