From 383d60f073688b9e563fde9944e30651be8c843f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 7 Jul 2020 14:44:27 +0200 Subject: [PATCH] 5.7-stable patches added patches: nfsd-apply-umask-on-fs-without-acl-support.patch revert-alsa-usb-audio-improve-frames-size-computation.patch spi-spi-fsl-dspi-fix-external-abort-on-interrupt-in-resume-or-exit-paths.patch spi-spi-fsl-dspi-fix-lockup-if-device-is-removed-during-spi-transfer.patch --- ...pply-umask-on-fs-without-acl-support.patch | 56 +++++++ ...udio-improve-frames-size-computation.patch | 144 ++++++++++++++++++ queue-5.7/series | 4 + ...on-interrupt-in-resume-or-exit-paths.patch | 122 +++++++++++++++ ...evice-is-removed-during-spi-transfer.patch | 51 +++++++ 5 files changed, 377 insertions(+) create mode 100644 queue-5.7/nfsd-apply-umask-on-fs-without-acl-support.patch create mode 100644 queue-5.7/revert-alsa-usb-audio-improve-frames-size-computation.patch create mode 100644 queue-5.7/spi-spi-fsl-dspi-fix-external-abort-on-interrupt-in-resume-or-exit-paths.patch create mode 100644 queue-5.7/spi-spi-fsl-dspi-fix-lockup-if-device-is-removed-during-spi-transfer.patch diff --git a/queue-5.7/nfsd-apply-umask-on-fs-without-acl-support.patch b/queue-5.7/nfsd-apply-umask-on-fs-without-acl-support.patch new file mode 100644 index 00000000000..36a31fc2b56 --- /dev/null +++ b/queue-5.7/nfsd-apply-umask-on-fs-without-acl-support.patch @@ -0,0 +1,56 @@ +From 22cf8419f1319ff87ec759d0ebdff4cbafaee832 Mon Sep 17 00:00:00 2001 +From: "J. Bruce Fields" +Date: Tue, 16 Jun 2020 16:43:18 -0400 +Subject: nfsd: apply umask on fs without ACL support + +From: J. Bruce Fields + +commit 22cf8419f1319ff87ec759d0ebdff4cbafaee832 upstream. + +The server is failing to apply the umask when creating new objects on +filesystems without ACL support. + +To reproduce this, you need to use NFSv4.2 and a client and server +recent enough to support umask, and you need to export a filesystem that +lacks ACL support (for example, ext4 with the "noacl" mount option). + +Filesystems with ACL support are expected to take care of the umask +themselves (usually by calling posix_acl_create). + +For filesystems without ACL support, this is up to the caller of +vfs_create(), vfs_mknod(), or vfs_mkdir(). + +Reported-by: Elliott Mitchell +Reported-by: Salvatore Bonaccorso +Tested-by: Salvatore Bonaccorso +Fixes: 47057abde515 ("nfsd: add support for the umask attribute") +Cc: stable@vger.kernel.org +Signed-off-by: J. Bruce Fields +Signed-off-by: Greg Kroah-Hartman + +--- + fs/nfsd/vfs.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/fs/nfsd/vfs.c ++++ b/fs/nfsd/vfs.c +@@ -1225,6 +1225,9 @@ nfsd_create_locked(struct svc_rqst *rqst + iap->ia_mode = 0; + iap->ia_mode = (iap->ia_mode & S_IALLUGO) | type; + ++ if (!IS_POSIXACL(dirp)) ++ iap->ia_mode &= ~current_umask(); ++ + err = 0; + host_err = 0; + switch (type) { +@@ -1457,6 +1460,9 @@ do_nfsd_create(struct svc_rqst *rqstp, s + goto out; + } + ++ if (!IS_POSIXACL(dirp)) ++ iap->ia_mode &= ~current_umask(); ++ + host_err = vfs_create(dirp, dchild, iap->ia_mode, true); + if (host_err < 0) { + fh_drop_write(fhp); diff --git a/queue-5.7/revert-alsa-usb-audio-improve-frames-size-computation.patch b/queue-5.7/revert-alsa-usb-audio-improve-frames-size-computation.patch new file mode 100644 index 00000000000..4a2e6455c59 --- /dev/null +++ b/queue-5.7/revert-alsa-usb-audio-improve-frames-size-computation.patch @@ -0,0 +1,144 @@ +From 22cfd031dc5354715bf1dd143f1e664d3f70febf Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Tue, 7 Jul 2020 14:42:38 +0200 +Subject: Revert "ALSA: usb-audio: Improve frames size computation" + +From: Greg Kroah-Hartman + +This reverts commit d288dc74f8cf95cb7ae0aaf245b7128627a49bf3 which is +commit f0bd62b64016508938df9babe47f65c2c727d25c upstream. + +It causes a number of reported issues and a fix for it has not hit +Linus's tree yet. Revert this to resolve those problems. + +Cc: Alexander Tsoy +Cc: Takashi Iwai +Cc: Sasha Levin +Cc: Hans de Goede +Signed-off-by: Greg Kroah-Hartman +--- + sound/usb/card.h | 4 ---- + sound/usb/endpoint.c | 43 +++++-------------------------------------- + sound/usb/endpoint.h | 1 - + sound/usb/pcm.c | 2 -- + 4 files changed, 5 insertions(+), 45 deletions(-) + +--- a/sound/usb/card.h ++++ b/sound/usb/card.h +@@ -84,10 +84,6 @@ struct snd_usb_endpoint { + dma_addr_t sync_dma; /* DMA address of syncbuf */ + + unsigned int pipe; /* the data i/o pipe */ +- unsigned int framesize[2]; /* small/large frame sizes in samples */ +- unsigned int sample_rem; /* remainder from division fs/fps */ +- unsigned int sample_accum; /* sample accumulator */ +- unsigned int fps; /* frames per second */ + unsigned int freqn; /* nominal sampling rate in fs/fps in Q16.16 format */ + unsigned int freqm; /* momentary sampling rate in fs/fps in Q16.16 format */ + int freqshift; /* how much to shift the feedback value to get Q16.16 */ +--- a/sound/usb/endpoint.c ++++ b/sound/usb/endpoint.c +@@ -124,12 +124,12 @@ int snd_usb_endpoint_implicit_feedback_s + + /* + * For streaming based on information derived from sync endpoints, +- * prepare_outbound_urb_sizes() will call slave_next_packet_size() to ++ * prepare_outbound_urb_sizes() will call next_packet_size() to + * determine the number of samples to be sent in the next packet. + * +- * For implicit feedback, slave_next_packet_size() is unused. ++ * For implicit feedback, next_packet_size() is unused. + */ +-int snd_usb_endpoint_slave_next_packet_size(struct snd_usb_endpoint *ep) ++int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep) + { + unsigned long flags; + int ret; +@@ -146,29 +146,6 @@ int snd_usb_endpoint_slave_next_packet_s + return ret; + } + +-/* +- * For adaptive and synchronous endpoints, prepare_outbound_urb_sizes() +- * will call next_packet_size() to determine the number of samples to be +- * sent in the next packet. +- */ +-int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep) +-{ +- int ret; +- +- if (ep->fill_max) +- return ep->maxframesize; +- +- ep->sample_accum += ep->sample_rem; +- if (ep->sample_accum >= ep->fps) { +- ep->sample_accum -= ep->fps; +- ret = ep->framesize[1]; +- } else { +- ret = ep->framesize[0]; +- } +- +- return ret; +-} +- + static void retire_outbound_urb(struct snd_usb_endpoint *ep, + struct snd_urb_ctx *urb_ctx) + { +@@ -213,8 +190,6 @@ static void prepare_silent_urb(struct sn + + if (ctx->packet_size[i]) + counts = ctx->packet_size[i]; +- else if (ep->sync_master) +- counts = snd_usb_endpoint_slave_next_packet_size(ep); + else + counts = snd_usb_endpoint_next_packet_size(ep); + +@@ -1086,17 +1061,10 @@ int snd_usb_endpoint_set_params(struct s + ep->maxpacksize = fmt->maxpacksize; + ep->fill_max = !!(fmt->attributes & UAC_EP_CS_ATTR_FILL_MAX); + +- if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_FULL) { ++ if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_FULL) + ep->freqn = get_usb_full_speed_rate(rate); +- ep->fps = 1000; +- } else { ++ else + ep->freqn = get_usb_high_speed_rate(rate); +- ep->fps = 8000; +- } +- +- ep->sample_rem = rate % ep->fps; +- ep->framesize[0] = rate / ep->fps; +- ep->framesize[1] = (rate + (ep->fps - 1)) / ep->fps; + + /* calculate the frequency in 16.16 format */ + ep->freqm = ep->freqn; +@@ -1155,7 +1123,6 @@ int snd_usb_endpoint_start(struct snd_us + ep->active_mask = 0; + ep->unlink_mask = 0; + ep->phase = 0; +- ep->sample_accum = 0; + + snd_usb_endpoint_start_quirk(ep); + +--- a/sound/usb/endpoint.h ++++ b/sound/usb/endpoint.h +@@ -28,7 +28,6 @@ void snd_usb_endpoint_release(struct snd + void snd_usb_endpoint_free(struct snd_usb_endpoint *ep); + + int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep); +-int snd_usb_endpoint_slave_next_packet_size(struct snd_usb_endpoint *ep); + int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep); + + void snd_usb_handle_sync_urb(struct snd_usb_endpoint *ep, +--- a/sound/usb/pcm.c ++++ b/sound/usb/pcm.c +@@ -1585,8 +1585,6 @@ static void prepare_playback_urb(struct + for (i = 0; i < ctx->packets; i++) { + if (ctx->packet_size[i]) + counts = ctx->packet_size[i]; +- else if (ep->sync_master) +- counts = snd_usb_endpoint_slave_next_packet_size(ep); + else + counts = snd_usb_endpoint_next_packet_size(ep); + diff --git a/queue-5.7/series b/queue-5.7/series index fb620188989..5c9ca2cdf93 100644 --- a/queue-5.7/series +++ b/queue-5.7/series @@ -82,3 +82,7 @@ i2c-algo-pca-add-0x78-as-scl-stuck-low-status-for-pc.patch i2c-designware-platdrv-set-class-based-on-dmi.patch i2c-mlxcpld-check-correct-size-of-maximum-recv_len-p.patch io_uring-fix-regression-with-always-ignoring-signals.patch +spi-spi-fsl-dspi-fix-lockup-if-device-is-removed-during-spi-transfer.patch +spi-spi-fsl-dspi-fix-external-abort-on-interrupt-in-resume-or-exit-paths.patch +nfsd-apply-umask-on-fs-without-acl-support.patch +revert-alsa-usb-audio-improve-frames-size-computation.patch diff --git a/queue-5.7/spi-spi-fsl-dspi-fix-external-abort-on-interrupt-in-resume-or-exit-paths.patch b/queue-5.7/spi-spi-fsl-dspi-fix-external-abort-on-interrupt-in-resume-or-exit-paths.patch new file mode 100644 index 00000000000..3fe5da66a05 --- /dev/null +++ b/queue-5.7/spi-spi-fsl-dspi-fix-external-abort-on-interrupt-in-resume-or-exit-paths.patch @@ -0,0 +1,122 @@ +From 3d87b613d6a3c6f0980e877ab0895785a2dde581 Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Mon, 22 Jun 2020 13:05:42 +0200 +Subject: spi: spi-fsl-dspi: Fix external abort on interrupt in resume or exit paths + +From: Krzysztof Kozlowski + +commit 3d87b613d6a3c6f0980e877ab0895785a2dde581 upstream. + +If shared interrupt comes late, during probe error path or device remove +(could be triggered with CONFIG_DEBUG_SHIRQ), the interrupt handler +dspi_interrupt() will access registers with the clock being disabled. +This leads to external abort on non-linefetch on Toradex Colibri VF50 +module (with Vybrid VF5xx): + + $ echo 4002d000.spi > /sys/devices/platform/soc/40000000.bus/4002d000.spi/driver/unbind + + Unhandled fault: external abort on non-linefetch (0x1008) at 0x8887f02c + Internal error: : 1008 [#1] ARM + Hardware name: Freescale Vybrid VF5xx/VF6xx (Device Tree) + Backtrace: + (regmap_mmio_read32le) + (regmap_mmio_read) + (_regmap_bus_reg_read) + (_regmap_read) + (regmap_read) + (dspi_interrupt) + (free_irq) + (devm_irq_release) + (release_nodes) + (devres_release_all) + (device_release_driver_internal) + +The resource-managed framework should not be used for shared interrupt +handling, because the interrupt handler might be called after releasing +other resources and disabling clocks. + +Similar bug could happen during suspend - the shared interrupt handler +could be invoked after suspending the device. Each device sharing this +interrupt line should disable the IRQ during suspend so handler will be +invoked only in following cases: +1. None suspended, +2. All devices resumed. + +Fixes: 349ad66c0ab0 ("spi:Add Freescale DSPI driver for Vybrid VF610 platform") +Signed-off-by: Krzysztof Kozlowski +Tested-by: Vladimir Oltean +Reviewed-by: Vladimir Oltean +Cc: +Link: https://lore.kernel.org/r/20200622110543.5035-3-krzk@kernel.org +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/spi/spi-fsl-dspi.c | 17 +++++++++++++---- + 1 file changed, 13 insertions(+), 4 deletions(-) + +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -1105,6 +1105,8 @@ static int dspi_suspend(struct device *d + struct spi_controller *ctlr = dev_get_drvdata(dev); + struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr); + ++ if (dspi->irq) ++ disable_irq(dspi->irq); + spi_controller_suspend(ctlr); + clk_disable_unprepare(dspi->clk); + +@@ -1125,6 +1127,8 @@ static int dspi_resume(struct device *de + if (ret) + return ret; + spi_controller_resume(ctlr); ++ if (dspi->irq) ++ enable_irq(dspi->irq); + + return 0; + } +@@ -1381,8 +1385,8 @@ static int dspi_probe(struct platform_de + goto poll_mode; + } + +- ret = devm_request_irq(&pdev->dev, dspi->irq, dspi_interrupt, +- IRQF_SHARED, pdev->name, dspi); ++ ret = request_threaded_irq(dspi->irq, dspi_interrupt, NULL, ++ IRQF_SHARED, pdev->name, dspi); + if (ret < 0) { + dev_err(&pdev->dev, "Unable to attach DSPI interrupt\n"); + goto out_clk_put; +@@ -1396,7 +1400,7 @@ poll_mode: + ret = dspi_request_dma(dspi, res->start); + if (ret < 0) { + dev_err(&pdev->dev, "can't get dma channels\n"); +- goto out_clk_put; ++ goto out_free_irq; + } + } + +@@ -1411,11 +1415,14 @@ poll_mode: + ret = spi_register_controller(ctlr); + if (ret != 0) { + dev_err(&pdev->dev, "Problem registering DSPI ctlr\n"); +- goto out_clk_put; ++ goto out_free_irq; + } + + return ret; + ++out_free_irq: ++ if (dspi->irq) ++ free_irq(dspi->irq, dspi); + out_clk_put: + clk_disable_unprepare(dspi->clk); + out_ctlr_put: +@@ -1441,6 +1448,8 @@ static int dspi_remove(struct platform_d + regmap_update_bits(dspi->regmap, SPI_MCR, SPI_MCR_HALT, SPI_MCR_HALT); + + dspi_release_dma(dspi); ++ if (dspi->irq) ++ free_irq(dspi->irq, dspi); + clk_disable_unprepare(dspi->clk); + + return 0; diff --git a/queue-5.7/spi-spi-fsl-dspi-fix-lockup-if-device-is-removed-during-spi-transfer.patch b/queue-5.7/spi-spi-fsl-dspi-fix-lockup-if-device-is-removed-during-spi-transfer.patch new file mode 100644 index 00000000000..3f28d40fd4a --- /dev/null +++ b/queue-5.7/spi-spi-fsl-dspi-fix-lockup-if-device-is-removed-during-spi-transfer.patch @@ -0,0 +1,51 @@ +From 7684580d45bd3d84ed9b453a4cadf7a9a5605a3f Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Mon, 22 Jun 2020 13:05:40 +0200 +Subject: spi: spi-fsl-dspi: Fix lockup if device is removed during SPI transfer + +From: Krzysztof Kozlowski + +commit 7684580d45bd3d84ed9b453a4cadf7a9a5605a3f upstream. + +During device removal, the driver should unregister the SPI controller +and stop the hardware. Otherwise the dspi_transfer_one_message() could +wait on completion infinitely. + +Additionally, calling spi_unregister_controller() first in device +removal reverse-matches the probe function, where SPI controller is +registered at the end. + +Fixes: 05209f457069 ("spi: fsl-dspi: add missing clk_disable_unprepare() in dspi_remove()") +Reported-by: Vladimir Oltean +Signed-off-by: Krzysztof Kozlowski +Cc: +Link: https://lore.kernel.org/r/20200622110543.5035-1-krzk@kernel.org +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/spi/spi-fsl-dspi.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -1430,9 +1430,18 @@ static int dspi_remove(struct platform_d + struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr); + + /* Disconnect from the SPI framework */ ++ spi_unregister_controller(dspi->ctlr); ++ ++ /* Disable RX and TX */ ++ regmap_update_bits(dspi->regmap, SPI_MCR, ++ SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF, ++ SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF); ++ ++ /* Stop Running */ ++ regmap_update_bits(dspi->regmap, SPI_MCR, SPI_MCR_HALT, SPI_MCR_HALT); ++ + dspi_release_dma(dspi); + clk_disable_unprepare(dspi->clk); +- spi_unregister_controller(dspi->ctlr); + + return 0; + } -- 2.47.3