From: Sasha Levin Date: Sat, 12 Feb 2022 05:44:14 +0000 (-0500) Subject: Fixes for 4.9 X-Git-Tag: v4.9.302~47 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=12ab9ede2806e083e9a33f4ace9130d5b43c3e0f;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.9 Signed-off-by: Sasha Levin --- diff --git a/queue-4.9/nfs-nfs4clinet-check-the-return-value-of-kstrdup.patch b/queue-4.9/nfs-nfs4clinet-check-the-return-value-of-kstrdup.patch new file mode 100644 index 00000000000..54fe07f8b68 --- /dev/null +++ b/queue-4.9/nfs-nfs4clinet-check-the-return-value-of-kstrdup.patch @@ -0,0 +1,40 @@ +From 2a5bc8e7941e8ed80260a290d32c571b8194b962 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 17 Dec 2021 01:01:33 +0800 +Subject: nfs: nfs4clinet: check the return value of kstrdup() + +From: Xiaoke Wang + +[ Upstream commit fbd2057e5329d3502a27491190237b6be52a1cb6 ] + +kstrdup() returns NULL when some internal memory errors happen, it is +better to check the return value of it so to catch the memory error in +time. + +Signed-off-by: Xiaoke Wang +Signed-off-by: Anna Schumaker +Signed-off-by: Sasha Levin +--- + fs/nfs/nfs4client.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c +index 2fb4633897084..48baa92846e5f 100644 +--- a/fs/nfs/nfs4client.c ++++ b/fs/nfs/nfs4client.c +@@ -1329,8 +1329,11 @@ int nfs4_update_server(struct nfs_server *server, const char *hostname, + goto out; + } + +- if (server->nfs_client->cl_hostname == NULL) ++ if (server->nfs_client->cl_hostname == NULL) { + server->nfs_client->cl_hostname = kstrdup(hostname, GFP_KERNEL); ++ if (server->nfs_client->cl_hostname == NULL) ++ return -ENOMEM; ++ } + nfs_server_insert_lists(server); + + error = nfs_probe_destination(server); +-- +2.34.1 + diff --git a/queue-4.9/nfsv4-only-print-the-label-when-its-queried.patch b/queue-4.9/nfsv4-only-print-the-label-when-its-queried.patch new file mode 100644 index 00000000000..12e44dbbebf --- /dev/null +++ b/queue-4.9/nfsv4-only-print-the-label-when-its-queried.patch @@ -0,0 +1,42 @@ +From 7bd961e55dc9dc635af83f4364ebeb5f236a2daf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 29 Nov 2021 15:33:56 -0500 +Subject: NFSv4 only print the label when its queried + +From: Olga Kornievskaia + +[ Upstream commit 2c52c8376db7160a1dd8a681c61c9258405ef143 ] + +When the bitmask of the attributes doesn't include the security label, +don't bother printing it. Since the label might not be null terminated, +adjust the printing format accordingly. + +Signed-off-by: Olga Kornievskaia +Signed-off-by: Anna Schumaker +Signed-off-by: Sasha Levin +--- + fs/nfs/nfs4xdr.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c +index 0a7c4e30a385e..29dbb14b6fd11 100644 +--- a/fs/nfs/nfs4xdr.c ++++ b/fs/nfs/nfs4xdr.c +@@ -4177,10 +4177,11 @@ static int decode_attr_security_label(struct xdr_stream *xdr, uint32_t *bitmap, + } else + printk(KERN_WARNING "%s: label too long (%u)!\n", + __func__, len); ++ if (label && label->label) ++ dprintk("%s: label=%.*s, len=%d, PI=%d, LFS=%d\n", ++ __func__, label->len, (char *)label->label, ++ label->len, label->pi, label->lfs); + } +- if (label && label->label) +- dprintk("%s: label=%s, len=%d, PI=%d, LFS=%d\n", __func__, +- (char *)label->label, label->len, label->pi, label->lfs); + return status; + + out_overflow: +-- +2.34.1 + diff --git a/queue-4.9/nfsv4-remove-zero-number-of-fs_locations-entries-err.patch b/queue-4.9/nfsv4-remove-zero-number-of-fs_locations-entries-err.patch new file mode 100644 index 00000000000..670cee18009 --- /dev/null +++ b/queue-4.9/nfsv4-remove-zero-number-of-fs_locations-entries-err.patch @@ -0,0 +1,50 @@ +From 34af4a30fc5ed7578452a68621b33415f0ddba74 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 Dec 2021 14:53:29 -0500 +Subject: NFSv4 remove zero number of fs_locations entries error check + +From: Olga Kornievskaia + +[ Upstream commit 90e12a3191040bd3854d3e236c35921e4e92a044 ] + +Remove the check for the zero length fs_locations reply in the +xdr decoding, and instead check for that in the migration code. + +Signed-off-by: Olga Kornievskaia +Signed-off-by: Anna Schumaker +Signed-off-by: Sasha Levin +--- + fs/nfs/nfs4state.c | 3 +++ + fs/nfs/nfs4xdr.c | 2 -- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c +index 4e63daeef6339..466c07bd06295 100644 +--- a/fs/nfs/nfs4state.c ++++ b/fs/nfs/nfs4state.c +@@ -1985,6 +1985,9 @@ static int nfs4_try_migration(struct nfs_server *server, struct rpc_cred *cred) + } + + result = -NFS4ERR_NXIO; ++ if (!locations->nlocations) ++ goto out; ++ + if (!(locations->fattr.valid & NFS_ATTR_FATTR_V4_LOCATIONS)) { + dprintk("<-- %s: No fs_locations data, migration skipped\n", + __func__); +diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c +index 29dbb14b6fd11..b50c97c6aecb3 100644 +--- a/fs/nfs/nfs4xdr.c ++++ b/fs/nfs/nfs4xdr.c +@@ -3633,8 +3633,6 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st + if (unlikely(!p)) + goto out_overflow; + n = be32_to_cpup(p); +- if (n <= 0) +- goto out_eio; + for (res->nlocations = 0; res->nlocations < n; res->nlocations++) { + u32 m; + struct nfs4_fs_location *loc; +-- +2.34.1 + diff --git a/queue-4.9/scsi-target-iscsi-make-sure-the-np-under-each-tpg-is.patch b/queue-4.9/scsi-target-iscsi-make-sure-the-np-under-each-tpg-is.patch new file mode 100644 index 00000000000..e9ccd05d24d --- /dev/null +++ b/queue-4.9/scsi-target-iscsi-make-sure-the-np-under-each-tpg-is.patch @@ -0,0 +1,43 @@ +From 7d0e6053d1356a8443757766bd08048807a2584c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 Jan 2022 13:47:42 +0800 +Subject: scsi: target: iscsi: Make sure the np under each tpg is unique + +From: ZouMingzhe + +[ Upstream commit a861790afaa8b6369eee8a88c5d5d73f5799c0c6 ] + +iscsit_tpg_check_network_portal() has nested for_each loops and is supposed +to return true when a match is found. However, the tpg loop will still +continue after existing the tpg_np loop. If this tpg_np is not the last the +match value will be changed. + +Break the outer loop after finding a match and make sure the np under each +tpg is unique. + +Link: https://lore.kernel.org/r/20220111054742.19582-1-mingzhe.zou@easystack.cn +Signed-off-by: ZouMingzhe +Reviewed-by: Mike Christie +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/target/iscsi/iscsi_target_tpg.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c +index 761b065a40bb3..b2a76ecb5789c 100644 +--- a/drivers/target/iscsi/iscsi_target_tpg.c ++++ b/drivers/target/iscsi/iscsi_target_tpg.c +@@ -452,6 +452,9 @@ static bool iscsit_tpg_check_network_portal( + break; + } + spin_unlock(&tpg->tpg_np_lock); ++ ++ if (match) ++ break; + } + spin_unlock(&tiqn->tiqn_tpg_lock); + +-- +2.34.1 + diff --git a/queue-4.9/series b/queue-4.9/series index 68ba494770d..20ef3139003 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -6,3 +6,8 @@ input-i8042-fix-misplaced-backport-of-add-asus-zenbook-flip-to-noselftest-list.p serial-sh-sci-fix-misplaced-backport-of-fix-late-enablement-of-autorts.patch alsa-line6-fix-misplaced-backport-of-fix-wrong-altsetting-for-line6_podhd500_1.patch revert-net-axienet-wait-for-phyrstcmplt-after-core-reset.patch +nfsv4-only-print-the-label-when-its-queried.patch +nfs-nfs4clinet-check-the-return-value-of-kstrdup.patch +nfsv4-remove-zero-number-of-fs_locations-entries-err.patch +scsi-target-iscsi-make-sure-the-np-under-each-tpg-is.patch +usb-dwc2-gadget-don-t-try-to-disable-ep0-in-dwc2_hso.patch diff --git a/queue-4.9/usb-dwc2-gadget-don-t-try-to-disable-ep0-in-dwc2_hso.patch b/queue-4.9/usb-dwc2-gadget-don-t-try-to-disable-ep0-in-dwc2_hso.patch new file mode 100644 index 00000000000..bb23a5d4a0a --- /dev/null +++ b/queue-4.9/usb-dwc2-gadget-don-t-try-to-disable-ep0-in-dwc2_hso.patch @@ -0,0 +1,50 @@ +From e28645b4acfc4d53bb3f94b0015d175ae495fc32 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 7 Dec 2021 14:01:01 +0100 +Subject: usb: dwc2: gadget: don't try to disable ep0 in dwc2_hsotg_suspend + +From: Amelie Delaunay + +[ Upstream commit ac55d163855924aa5af9f1560977da8f346963c8 ] + +Calling dwc2_hsotg_ep_disable on ep0 (in/out) will lead to the following +logs before returning -EINVAL: +dwc2 49000000.usb-otg: dwc2_hsotg_ep_disable: called for ep0 +dwc2 49000000.usb-otg: dwc2_hsotg_ep_disable: called for ep0 + +To avoid these two logs while suspending, start disabling the endpoint +from the index 1, as done in dwc2_hsotg_udc_stop: + + /* all endpoints should be shutdown */ + for (ep = 1; ep < hsotg->num_of_eps; ep++) { + if (hsotg->eps_in[ep]) + dwc2_hsotg_ep_disable_lock(&hsotg->eps_in[ep]->ep); + if (hsotg->eps_out[ep]) + dwc2_hsotg_ep_disable_lock(&hsotg->eps_out[ep]->ep); + } + +Acked-by: Minas Harutyunyan +Signed-off-by: Amelie Delaunay +Link: https://lore.kernel.org/r/20211207130101.270314-1-amelie.delaunay@foss.st.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/dwc2/gadget.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c +index e7ad3ae4ea6bd..65bcbbad6d545 100644 +--- a/drivers/usb/dwc2/gadget.c ++++ b/drivers/usb/dwc2/gadget.c +@@ -3979,7 +3979,7 @@ int dwc2_hsotg_suspend(struct dwc2_hsotg *hsotg) + hsotg->gadget.speed = USB_SPEED_UNKNOWN; + spin_unlock_irqrestore(&hsotg->lock, flags); + +- for (ep = 0; ep < hsotg->num_of_eps; ep++) { ++ for (ep = 1; ep < hsotg->num_of_eps; ep++) { + if (hsotg->eps_in[ep]) + dwc2_hsotg_ep_disable(&hsotg->eps_in[ep]->ep); + if (hsotg->eps_out[ep]) +-- +2.34.1 +