]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.14
authorSasha Levin <sashal@kernel.org>
Sat, 12 Feb 2022 05:44:13 +0000 (00:44 -0500)
committerSasha Levin <sashal@kernel.org>
Sat, 12 Feb 2022 05:44:13 +0000 (00:44 -0500)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.14/net-stmmac-dwmac-sun8i-use-return-val-of-readl_poll_.patch [new file with mode: 0644]
queue-4.14/nfs-nfs4clinet-check-the-return-value-of-kstrdup.patch [new file with mode: 0644]
queue-4.14/nfsv4-expose-nfs_parse_server_name-function.patch [new file with mode: 0644]
queue-4.14/nfsv4-only-print-the-label-when-its-queried.patch [new file with mode: 0644]
queue-4.14/nfsv4-remove-zero-number-of-fs_locations-entries-err.patch [new file with mode: 0644]
queue-4.14/nfsv4.1-fix-uninitialised-variable-in-devicenotify.patch [new file with mode: 0644]
queue-4.14/revert-net-axienet-wait-for-phyrstcmplt-after-core-r.patch [new file with mode: 0644]
queue-4.14/scsi-target-iscsi-make-sure-the-np-under-each-tpg-is.patch [new file with mode: 0644]
queue-4.14/series
queue-4.14/usb-dwc2-gadget-don-t-try-to-disable-ep0-in-dwc2_hso.patch [new file with mode: 0644]

diff --git a/queue-4.14/net-stmmac-dwmac-sun8i-use-return-val-of-readl_poll_.patch b/queue-4.14/net-stmmac-dwmac-sun8i-use-return-val-of-readl_poll_.patch
new file mode 100644 (file)
index 0000000..58d27b7
--- /dev/null
@@ -0,0 +1,42 @@
+From 5eb3dbe20701019c9b2e29030e7310d02f35a792 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 27 Jan 2022 00:52:15 +0800
+Subject: net: stmmac: dwmac-sun8i: use return val of readl_poll_timeout()
+
+From: Jisheng Zhang <jszhang@kernel.org>
+
+[ Upstream commit 9e0db41e7a0b6f1271cbcfb16dbf5b8641b4e440 ]
+
+When readl_poll_timeout() timeout, we'd better directly use its return
+value.
+
+Before this patch:
+[    2.145528] dwmac-sun8i: probe of 4500000.ethernet failed with error -14
+
+After this patch:
+[    2.138520] dwmac-sun8i: probe of 4500000.ethernet failed with error -110
+
+Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
+Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+index 8e60315a087c9..1027831e5d814 100644
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+@@ -630,7 +630,7 @@ static int sun8i_dwmac_reset(struct stmmac_priv *priv)
+       if (err) {
+               dev_err(priv->device, "EMAC reset timeout\n");
+-              return -EFAULT;
++              return err;
+       }
+       return 0;
+ }
+-- 
+2.34.1
+
diff --git a/queue-4.14/nfs-nfs4clinet-check-the-return-value-of-kstrdup.patch b/queue-4.14/nfs-nfs4clinet-check-the-return-value-of-kstrdup.patch
new file mode 100644 (file)
index 0000000..9bb1db5
--- /dev/null
@@ -0,0 +1,40 @@
+From 21d060145939a45ff28512aeedc766cf8c201f23 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 17 Dec 2021 01:01:33 +0800
+Subject: nfs: nfs4clinet: check the return value of kstrdup()
+
+From: Xiaoke Wang <xkernel.wang@foxmail.com>
+
+[ 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 <xkernel.wang@foxmail.com>
+Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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 02b01b4025f6e..c7672c89b9673 100644
+--- a/fs/nfs/nfs4client.c
++++ b/fs/nfs/nfs4client.c
+@@ -1241,8 +1241,11 @@ int nfs4_update_server(struct nfs_server *server, const char *hostname,
+       }
+       nfs_put_client(clp);
+-      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);
+       return nfs_probe_destination(server);
+-- 
+2.34.1
+
diff --git a/queue-4.14/nfsv4-expose-nfs_parse_server_name-function.patch b/queue-4.14/nfsv4-expose-nfs_parse_server_name-function.patch
new file mode 100644 (file)
index 0000000..96c2ff8
--- /dev/null
@@ -0,0 +1,51 @@
+From 85afb8f50c80fdb7e68491c111f2803f176fc847 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 9 Dec 2021 14:53:32 -0500
+Subject: NFSv4 expose nfs_parse_server_name function
+
+From: Olga Kornievskaia <kolga@netapp.com>
+
+[ Upstream commit f5b27cc6761e27ee6387a24df1a99ca77b360fea ]
+
+Make nfs_parse_server_name available outside of nfs4namespace.c.
+
+Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
+Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfs/nfs4_fs.h       | 3 ++-
+ fs/nfs/nfs4namespace.c | 4 ++--
+ 2 files changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
+index 22cff39cca29a..c9ca2237c3fec 100644
+--- a/fs/nfs/nfs4_fs.h
++++ b/fs/nfs/nfs4_fs.h
+@@ -242,7 +242,8 @@ struct vfsmount *nfs4_submount(struct nfs_server *, struct dentry *,
+                              struct nfs_fh *, struct nfs_fattr *);
+ int nfs4_replace_transport(struct nfs_server *server,
+                               const struct nfs4_fs_locations *locations);
+-
++size_t nfs_parse_server_name(char *string, size_t len, struct sockaddr *sa,
++                           size_t salen, struct net *net);
+ /* nfs4proc.c */
+ extern int nfs4_handle_exception(struct nfs_server *, int, struct nfs4_exception *);
+ extern int nfs4_call_sync(struct rpc_clnt *, struct nfs_server *,
+diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c
+index 8c3f327d858d5..b36361ca0d36b 100644
+--- a/fs/nfs/nfs4namespace.c
++++ b/fs/nfs/nfs4namespace.c
+@@ -121,8 +121,8 @@ static int nfs4_validate_fspath(struct dentry *dentry,
+       return 0;
+ }
+-static size_t nfs_parse_server_name(char *string, size_t len,
+-              struct sockaddr *sa, size_t salen, struct net *net)
++size_t nfs_parse_server_name(char *string, size_t len, struct sockaddr *sa,
++                           size_t salen, struct net *net)
+ {
+       ssize_t ret;
+-- 
+2.34.1
+
diff --git a/queue-4.14/nfsv4-only-print-the-label-when-its-queried.patch b/queue-4.14/nfsv4-only-print-the-label-when-its-queried.patch
new file mode 100644 (file)
index 0000000..93789ed
--- /dev/null
@@ -0,0 +1,42 @@
+From abe6c766b35a9e58db1db4715215798104d609a8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 29 Nov 2021 15:33:56 -0500
+Subject: NFSv4 only print the label when its queried
+
+From: Olga Kornievskaia <kolga@netapp.com>
+
+[ 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 <kolga@netapp.com>
+Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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 3cd04c98da6bc..99facb5f186fd 100644
+--- a/fs/nfs/nfs4xdr.c
++++ b/fs/nfs/nfs4xdr.c
+@@ -4272,10 +4272,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.14/nfsv4-remove-zero-number-of-fs_locations-entries-err.patch b/queue-4.14/nfsv4-remove-zero-number-of-fs_locations-entries-err.patch
new file mode 100644 (file)
index 0000000..b67a413
--- /dev/null
@@ -0,0 +1,50 @@
+From 0799be98b0aae08a66c7135dfac5c95ab1f25ce3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 9 Dec 2021 14:53:29 -0500
+Subject: NFSv4 remove zero number of fs_locations entries error check
+
+From: Olga Kornievskaia <kolga@netapp.com>
+
+[ 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 <kolga@netapp.com>
+Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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 f92bfc787c5fe..c0987557d4ab4 100644
+--- a/fs/nfs/nfs4state.c
++++ b/fs/nfs/nfs4state.c
+@@ -2003,6 +2003,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 99facb5f186fd..ccdc0ca699c39 100644
+--- a/fs/nfs/nfs4xdr.c
++++ b/fs/nfs/nfs4xdr.c
+@@ -3731,8 +3731,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.14/nfsv4.1-fix-uninitialised-variable-in-devicenotify.patch b/queue-4.14/nfsv4.1-fix-uninitialised-variable-in-devicenotify.patch
new file mode 100644 (file)
index 0000000..616a257
--- /dev/null
@@ -0,0 +1,106 @@
+From 59c94cfa8ffeb8380c01f5172d0ba14506347000 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 3 Jan 2022 14:50:16 -0500
+Subject: NFSv4.1: Fix uninitialised variable in devicenotify
+
+From: Trond Myklebust <trond.myklebust@hammerspace.com>
+
+[ Upstream commit b05bf5c63b326ce1da84ef42498d8e0e292e694c ]
+
+When decode_devicenotify_args() exits with no entries, we need to
+ensure that the struct cb_devicenotifyargs is initialised to
+{ 0, NULL } in order to avoid problems in
+nfs4_callback_devicenotify().
+
+Reported-by: <rtm@csail.mit.edu>
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfs/callback.h      |  2 +-
+ fs/nfs/callback_proc.c |  2 +-
+ fs/nfs/callback_xdr.c  | 18 +++++++++---------
+ 3 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/fs/nfs/callback.h b/fs/nfs/callback.h
+index a20a0bce40a48..80ad04abcf309 100644
+--- a/fs/nfs/callback.h
++++ b/fs/nfs/callback.h
+@@ -168,7 +168,7 @@ struct cb_devicenotifyitem {
+ };
+ struct cb_devicenotifyargs {
+-      int                              ndevs;
++      uint32_t                         ndevs;
+       struct cb_devicenotifyitem       *devs;
+ };
+diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
+index 440ff8e7082b6..3998b432e1b98 100644
+--- a/fs/nfs/callback_proc.c
++++ b/fs/nfs/callback_proc.c
+@@ -355,7 +355,7 @@ __be32 nfs4_callback_devicenotify(void *argp, void *resp,
+                                 struct cb_process_state *cps)
+ {
+       struct cb_devicenotifyargs *args = argp;
+-      int i;
++      uint32_t i;
+       __be32 res = 0;
+       struct nfs_client *clp = cps->clp;
+       struct nfs_server *server = NULL;
+diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
+index 57de914630bc9..36c34be839d09 100644
+--- a/fs/nfs/callback_xdr.c
++++ b/fs/nfs/callback_xdr.c
+@@ -265,11 +265,9 @@ __be32 decode_devicenotify_args(struct svc_rqst *rqstp,
+                               void *argp)
+ {
+       struct cb_devicenotifyargs *args = argp;
++      uint32_t tmp, n, i;
+       __be32 *p;
+       __be32 status = 0;
+-      u32 tmp;
+-      int n, i;
+-      args->ndevs = 0;
+       /* Num of device notifications */
+       p = read_buf(xdr, sizeof(uint32_t));
+@@ -278,7 +276,7 @@ __be32 decode_devicenotify_args(struct svc_rqst *rqstp,
+               goto out;
+       }
+       n = ntohl(*p++);
+-      if (n <= 0)
++      if (n == 0)
+               goto out;
+       if (n > ULONG_MAX / sizeof(*args->devs)) {
+               status = htonl(NFS4ERR_BADXDR);
+@@ -336,19 +334,21 @@ __be32 decode_devicenotify_args(struct svc_rqst *rqstp,
+                       dev->cbd_immediate = 0;
+               }
+-              args->ndevs++;
+-
+               dprintk("%s: type %d layout 0x%x immediate %d\n",
+                       __func__, dev->cbd_notify_type, dev->cbd_layout_type,
+                       dev->cbd_immediate);
+       }
++      args->ndevs = n;
++      dprintk("%s: ndevs %d\n", __func__, args->ndevs);
++      return 0;
++err:
++      kfree(args->devs);
+ out:
++      args->devs = NULL;
++      args->ndevs = 0;
+       dprintk("%s: status %d ndevs %d\n",
+               __func__, ntohl(status), args->ndevs);
+       return status;
+-err:
+-      kfree(args->devs);
+-      goto out;
+ }
+ static __be32 decode_sessionid(struct xdr_stream *xdr,
+-- 
+2.34.1
+
diff --git a/queue-4.14/revert-net-axienet-wait-for-phyrstcmplt-after-core-r.patch b/queue-4.14/revert-net-axienet-wait-for-phyrstcmplt-after-core-r.patch
new file mode 100644 (file)
index 0000000..1f0b0d5
--- /dev/null
@@ -0,0 +1,38 @@
+From 1e55d4f3d21054d791c51a3426cd5c0b4665acd3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 11 Feb 2022 18:25:23 -0500
+Subject: Revert "net: axienet: Wait for PhyRstCmplt after core reset"
+
+This reverts commit ff594e1b6f39f07f050759de2d27c36b7739c0c9.
+
+Breaks the build on 4.14 and 4.9.
+
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 10 ----------
+ 1 file changed, 10 deletions(-)
+
+diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+index d2ba466613c0a..7876e56a5b5db 100644
+--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
++++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+@@ -279,16 +279,6 @@ static int axienet_dma_bd_init(struct net_device *ndev)
+       axienet_dma_out32(lp, XAXIDMA_TX_CR_OFFSET,
+                         cr | XAXIDMA_CR_RUNSTOP_MASK);
+-      /* Wait for PhyRstCmplt bit to be set, indicating the PHY reset has finished */
+-      ret = read_poll_timeout(axienet_ior, value,
+-                              value & XAE_INT_PHYRSTCMPLT_MASK,
+-                              DELAY_OF_ONE_MILLISEC, 50000, false, lp,
+-                              XAE_IS_OFFSET);
+-      if (ret) {
+-              dev_err(lp->dev, "%s: timeout waiting for PhyRstCmplt\n", __func__);
+-              return ret;
+-      }
+-
+       return 0;
+ out:
+       axienet_dma_bd_release(ndev);
+-- 
+2.34.1
+
diff --git a/queue-4.14/scsi-target-iscsi-make-sure-the-np-under-each-tpg-is.patch b/queue-4.14/scsi-target-iscsi-make-sure-the-np-under-each-tpg-is.patch
new file mode 100644 (file)
index 0000000..b2a1cb5
--- /dev/null
@@ -0,0 +1,43 @@
+From 62c757c85ab9cf067086e6be91daff65ebcb3dfd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 11 Jan 2022 13:47:42 +0800
+Subject: scsi: target: iscsi: Make sure the np under each tpg is unique
+
+From: ZouMingzhe <mingzhe.zou@easystack.cn>
+
+[ 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 <mingzhe.zou@easystack.cn>
+Reviewed-by: Mike Christie <michael.christie@oracle.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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 16e7516052a44..2b78843091a2e 100644
+--- a/drivers/target/iscsi/iscsi_target_tpg.c
++++ b/drivers/target/iscsi/iscsi_target_tpg.c
+@@ -448,6 +448,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
+
index 792c6dbc71f91aba62d736d843beb44fc2abb808..eaee217788573baf64d3c2488a1d55efd67501e4 100644 (file)
@@ -5,3 +5,12 @@ mmc-sdhci-of-esdhc-check-for-error-num-after-setting-mask.patch
 net-phy-marvell-fix-mdi-x-polarity-setting-in-88e1118-compatible-phys.patch
 nfs-fix-initialisation-of-nfs_client-cl_flags-field.patch
 nfsd-clamp-write-offsets.patch
+nfsv4-only-print-the-label-when-its-queried.patch
+nfs-nfs4clinet-check-the-return-value-of-kstrdup.patch
+nfsv4.1-fix-uninitialised-variable-in-devicenotify.patch
+nfsv4-remove-zero-number-of-fs_locations-entries-err.patch
+nfsv4-expose-nfs_parse_server_name-function.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
+net-stmmac-dwmac-sun8i-use-return-val-of-readl_poll_.patch
+revert-net-axienet-wait-for-phyrstcmplt-after-core-r.patch
diff --git a/queue-4.14/usb-dwc2-gadget-don-t-try-to-disable-ep0-in-dwc2_hso.patch b/queue-4.14/usb-dwc2-gadget-don-t-try-to-disable-ep0-in-dwc2_hso.patch
new file mode 100644 (file)
index 0000000..46cf3c9
--- /dev/null
@@ -0,0 +1,50 @@
+From 645b56d8fff936c6508411566ed413da418bd4af Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+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 <amelie.delaunay@foss.st.com>
+
+[ 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 <Minas.Harutyunyan@synopsys.com>
+Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
+Link: https://lore.kernel.org/r/20211207130101.270314-1-amelie.delaunay@foss.st.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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 f1edc5727000c..dddc5d02b5524 100644
+--- a/drivers/usb/dwc2/gadget.c
++++ b/drivers/usb/dwc2/gadget.c
+@@ -4783,7 +4783,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
+