]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 7 Mar 2019 16:05:40 +0000 (17:05 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 7 Mar 2019 16:05:40 +0000 (17:05 +0100)
added patches:
ncpfs-fix-build-warning-of-strncpy.patch
sockfs-getxattr-fail-with-eopnotsupp-for-invalid-attribute-names.patch

queue-4.4/ncpfs-fix-build-warning-of-strncpy.patch [new file with mode: 0644]
queue-4.4/series
queue-4.4/sockfs-getxattr-fail-with-eopnotsupp-for-invalid-attribute-names.patch [new file with mode: 0644]

diff --git a/queue-4.4/ncpfs-fix-build-warning-of-strncpy.patch b/queue-4.4/ncpfs-fix-build-warning-of-strncpy.patch
new file mode 100644 (file)
index 0000000..f1a2d76
--- /dev/null
@@ -0,0 +1,43 @@
+From foo@baz Thu Mar  7 17:02:50 CET 2019
+Date: Thu, 07 Mar 2019 17:02:50 +0100
+To: Greg KH <gregkh@linuxfoundation.org>
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Subject: ncpfs: fix build warning of strncpy
+
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+Not upstream as ncpfs is long deleted.
+
+Fix up two strncpy build warnings in ncp_get_charsets() by using strscpy
+and the max size of the array.
+
+It's not like anyone uses this code anyway, and this gets rid of two
+build warnings so that we can see real warnings as they pop up over
+time.
+
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ncpfs/ioctl.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/fs/ncpfs/ioctl.c
++++ b/fs/ncpfs/ioctl.c
+@@ -233,7 +233,7 @@ ncp_get_charsets(struct ncp_server* serv
+               len = strlen(server->nls_vol->charset);
+               if (len > NCP_IOCSNAME_LEN)
+                       len = NCP_IOCSNAME_LEN;
+-              strncpy(user.codepage, server->nls_vol->charset, len);
++              strscpy(user.codepage, server->nls_vol->charset, NCP_IOCSNAME_LEN);
+               user.codepage[len] = 0;
+       }
+@@ -243,7 +243,7 @@ ncp_get_charsets(struct ncp_server* serv
+               len = strlen(server->nls_io->charset);
+               if (len > NCP_IOCSNAME_LEN)
+                       len = NCP_IOCSNAME_LEN;
+-              strncpy(user.iocharset, server->nls_io->charset, len);
++              strscpy(user.iocharset, server->nls_io->charset, NCP_IOCSNAME_LEN);
+               user.iocharset[len] = 0;
+       }
+       mutex_unlock(&server->root_setup_lock);
index 885a07f0e598588e6fb1ff6c80adf4e9f15a263c..8d456f6c8228a3d3956868309b3c4a0c7432e79c 100644 (file)
@@ -56,3 +56,5 @@ usb-serial-option-add-telit-me910-ecm-composition.patch
 usb-serial-cp210x-add-id-for-ingenico-3070.patch
 usb-serial-ftdi_sio-add-id-for-hjelmslund-electronics-usb485.patch
 cpufreq-use-struct-kobj_attribute-instead-of-struct-global_attr.patch
+sockfs-getxattr-fail-with-eopnotsupp-for-invalid-attribute-names.patch
+ncpfs-fix-build-warning-of-strncpy.patch
diff --git a/queue-4.4/sockfs-getxattr-fail-with-eopnotsupp-for-invalid-attribute-names.patch b/queue-4.4/sockfs-getxattr-fail-with-eopnotsupp-for-invalid-attribute-names.patch
new file mode 100644 (file)
index 0000000..a687bc8
--- /dev/null
@@ -0,0 +1,61 @@
+From 971df15bd54ad46e907046ff33750a137b2f0096 Mon Sep 17 00:00:00 2001
+From: Andreas Gruenbacher <agruenba@redhat.com>
+Date: Thu, 29 Sep 2016 17:48:34 +0200
+Subject: sockfs: getxattr: Fail with -EOPNOTSUPP for invalid attribute names
+
+From: Andreas Gruenbacher <agruenba@redhat.com>
+
+commit 971df15bd54ad46e907046ff33750a137b2f0096 upstream.
+
+The standard return value for unsupported attribute names is
+-EOPNOTSUPP, as opposed to undefined but supported attributes
+(-ENODATA).
+
+Also, fail for attribute names like "system.sockprotonameXXX" and
+simplify the code a bit.
+
+Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
+Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
+[removes a build warning on 4.4.y - gregkh]
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/socket.c |   24 ++++++------------------
+ 1 file changed, 6 insertions(+), 18 deletions(-)
+
+--- a/net/socket.c
++++ b/net/socket.c
+@@ -470,27 +470,15 @@ static struct socket *sockfd_lookup_ligh
+ static ssize_t sockfs_getxattr(struct dentry *dentry,
+                              const char *name, void *value, size_t size)
+ {
+-      const char *proto_name;
+-      size_t proto_size;
+-      int error;
+-
+-      error = -ENODATA;
+-      if (!strncmp(name, XATTR_NAME_SOCKPROTONAME, XATTR_NAME_SOCKPROTONAME_LEN)) {
+-              proto_name = dentry->d_name.name;
+-              proto_size = strlen(proto_name);
+-
++      if (!strcmp(name, XATTR_NAME_SOCKPROTONAME)) {
+               if (value) {
+-                      error = -ERANGE;
+-                      if (proto_size + 1 > size)
+-                              goto out;
+-
+-                      strncpy(value, proto_name, proto_size + 1);
++                      if (dentry->d_name.len + 1 > size)
++                              return -ERANGE;
++                      memcpy(value, dentry->d_name.name, dentry->d_name.len + 1);
+               }
+-              error = proto_size + 1;
++              return dentry->d_name.len + 1;
+       }
+-
+-out:
+-      return error;
++      return -EOPNOTSUPP;
+ }
+ static ssize_t sockfs_listxattr(struct dentry *dentry, char *buffer,