From: Greg Kroah-Hartman Date: Mon, 14 Jun 2021 08:47:49 +0000 (+0200) Subject: 4.4-stable patches X-Git-Tag: v4.4.273~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bde48afa42a5c610dd25e8a580d3d0c811b7e191;p=thirdparty%2Fkernel%2Fstable-queue.git 4.4-stable patches added patches: nfsv4-nfs4_proc_set_acl-needs-to-restore-nfs_cap_uidgid_nomap-on-error.patch scsi-core-only-put-parent-device-if-host-state-differs-from-shost_created.patch --- diff --git a/queue-4.4/nfsv4-nfs4_proc_set_acl-needs-to-restore-nfs_cap_uidgid_nomap-on-error.patch b/queue-4.4/nfsv4-nfs4_proc_set_acl-needs-to-restore-nfs_cap_uidgid_nomap-on-error.patch new file mode 100644 index 00000000000..4ae840c817b --- /dev/null +++ b/queue-4.4/nfsv4-nfs4_proc_set_acl-needs-to-restore-nfs_cap_uidgid_nomap-on-error.patch @@ -0,0 +1,62 @@ +From f8849e206ef52b584cd9227255f4724f0cc900bb Mon Sep 17 00:00:00 2001 +From: Dai Ngo +Date: Wed, 19 May 2021 17:15:10 -0400 +Subject: NFSv4: nfs4_proc_set_acl needs to restore NFS_CAP_UIDGID_NOMAP on error. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Dai Ngo + +commit f8849e206ef52b584cd9227255f4724f0cc900bb upstream. + +Currently if __nfs4_proc_set_acl fails with NFS4ERR_BADOWNER it +re-enables the idmapper by clearing NFS_CAP_UIDGID_NOMAP before +retrying again. The NFS_CAP_UIDGID_NOMAP remains cleared even if +the retry fails. This causes problem for subsequent setattr +requests for v4 server that does not have idmapping configured. + +This patch modifies nfs4_proc_set_acl to detect NFS4ERR_BADOWNER +and NFS4ERR_BADNAME and skips the retry, since the kernel isn't +involved in encoding the ACEs, and return -EINVAL. + +Steps to reproduce the problem: + + # mount -o vers=4.1,sec=sys server:/export/test /tmp/mnt + # touch /tmp/mnt/file1 + # chown 99 /tmp/mnt/file1 + # nfs4_setfacl -a A::unknown.user@xyz.com:wrtncy /tmp/mnt/file1 + Failed setxattr operation: Invalid argument + # chown 99 /tmp/mnt/file1 + chown: changing ownership of ‘/tmp/mnt/file1’: Invalid argument + # umount /tmp/mnt + # mount -o vers=4.1,sec=sys server:/export/test /tmp/mnt + # chown 99 /tmp/mnt/file1 + # + +v2: detect NFS4ERR_BADOWNER and NFS4ERR_BADNAME and skip retry + in nfs4_proc_set_acl. +Signed-off-by: Dai Ngo +Signed-off-by: Trond Myklebust +Signed-off-by: Greg Kroah-Hartman +--- + fs/nfs/nfs4proc.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/fs/nfs/nfs4proc.c ++++ b/fs/nfs/nfs4proc.c +@@ -4887,6 +4887,14 @@ static int nfs4_proc_set_acl(struct inod + do { + err = __nfs4_proc_set_acl(inode, buf, buflen); + trace_nfs4_set_acl(inode, err); ++ if (err == -NFS4ERR_BADOWNER || err == -NFS4ERR_BADNAME) { ++ /* ++ * no need to retry since the kernel ++ * isn't involved in encoding the ACEs. ++ */ ++ err = -EINVAL; ++ break; ++ } + err = nfs4_handle_exception(NFS_SERVER(inode), err, + &exception); + } while (exception.retry); diff --git a/queue-4.4/scsi-core-only-put-parent-device-if-host-state-differs-from-shost_created.patch b/queue-4.4/scsi-core-only-put-parent-device-if-host-state-differs-from-shost_created.patch new file mode 100644 index 00000000000..8c7f644d291 --- /dev/null +++ b/queue-4.4/scsi-core-only-put-parent-device-if-host-state-differs-from-shost_created.patch @@ -0,0 +1,37 @@ +From 1e0d4e6225996f05271de1ebcb1a7c9381af0b27 Mon Sep 17 00:00:00 2001 +From: Ming Lei +Date: Wed, 2 Jun 2021 21:30:29 +0800 +Subject: scsi: core: Only put parent device if host state differs from SHOST_CREATED + +From: Ming Lei + +commit 1e0d4e6225996f05271de1ebcb1a7c9381af0b27 upstream. + +get_device(shost->shost_gendev.parent) is called after host state has +switched to SHOST_RUNNING. scsi_host_dev_release() shouldn't release the +parent device if host state is still SHOST_CREATED. + +Link: https://lore.kernel.org/r/20210602133029.2864069-5-ming.lei@redhat.com +Cc: Bart Van Assche +Cc: John Garry +Cc: Hannes Reinecke +Tested-by: John Garry +Reviewed-by: John Garry +Signed-off-by: Ming Lei +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/hosts.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/hosts.c ++++ b/drivers/scsi/hosts.c +@@ -355,7 +355,7 @@ static void scsi_host_dev_release(struct + + kfree(shost->shost_data); + +- if (parent) ++ if (shost->shost_state != SHOST_CREATED) + put_device(parent); + kfree(shost); + } diff --git a/queue-4.4/series b/queue-4.4/series index bac400b32cc..6d7dfb061d2 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -29,3 +29,5 @@ perf-fix-data-race-between-pin_count-increment-decrement.patch nfs-fix-a-potential-null-dereference-in-nfs_get_clie.patch perf-session-correct-buffer-copying-when-peeking-eve.patch kvm-fix-previous-commit-for-32-bit-builds.patch +nfsv4-nfs4_proc_set_acl-needs-to-restore-nfs_cap_uidgid_nomap-on-error.patch +scsi-core-only-put-parent-device-if-host-state-differs-from-shost_created.patch