From: Greg Kroah-Hartman Date: Thu, 7 Mar 2019 16:05:40 +0000 (+0100) Subject: 4.4-stable patches X-Git-Tag: v5.0.1~38 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f36f0171f60d9bab3af1b2ec77ba9d21130c6427;p=thirdparty%2Fkernel%2Fstable-queue.git 4.4-stable patches added patches: ncpfs-fix-build-warning-of-strncpy.patch sockfs-getxattr-fail-with-eopnotsupp-for-invalid-attribute-names.patch --- 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 index 00000000000..f1a2d76cca6 --- /dev/null +++ b/queue-4.4/ncpfs-fix-build-warning-of-strncpy.patch @@ -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 +From: Greg Kroah-Hartman +Subject: ncpfs: fix build warning of strncpy + +From: Greg Kroah-Hartman + +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 + +--- + 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); diff --git a/queue-4.4/series b/queue-4.4/series index 885a07f0e59..8d456f6c822 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -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 index 00000000000..a687bc8d46a --- /dev/null +++ b/queue-4.4/sockfs-getxattr-fail-with-eopnotsupp-for-invalid-attribute-names.patch @@ -0,0 +1,61 @@ +From 971df15bd54ad46e907046ff33750a137b2f0096 Mon Sep 17 00:00:00 2001 +From: Andreas Gruenbacher +Date: Thu, 29 Sep 2016 17:48:34 +0200 +Subject: sockfs: getxattr: Fail with -EOPNOTSUPP for invalid attribute names + +From: Andreas Gruenbacher + +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 +Signed-off-by: Al Viro +[removes a build warning on 4.4.y - gregkh] +Signed-off-by: Greg Kroah-Hartman + +--- + 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,