]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Oct 2022 07:28:14 +0000 (09:28 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Oct 2022 07:28:14 +0000 (09:28 +0200)
added patches:
cifs-destage-dirty-pages-before-re-reading-them-for-cache-none.patch
iio-dac-ad5593r-fix-i2c-read-protocol-requirements.patch

queue-4.14/cifs-destage-dirty-pages-before-re-reading-them-for-cache-none.patch [new file with mode: 0644]
queue-4.14/iio-dac-ad5593r-fix-i2c-read-protocol-requirements.patch [new file with mode: 0644]
queue-4.14/series

diff --git a/queue-4.14/cifs-destage-dirty-pages-before-re-reading-them-for-cache-none.patch b/queue-4.14/cifs-destage-dirty-pages-before-re-reading-them-for-cache-none.patch
new file mode 100644 (file)
index 0000000..4f39994
--- /dev/null
@@ -0,0 +1,44 @@
+From bb44c31cdcac107344dd2fcc3bd0504a53575c51 Mon Sep 17 00:00:00 2001
+From: Ronnie Sahlberg <lsahlber@redhat.com>
+Date: Tue, 20 Sep 2022 14:32:02 +1000
+Subject: cifs: destage dirty pages before re-reading them for cache=none
+
+From: Ronnie Sahlberg <lsahlber@redhat.com>
+
+commit bb44c31cdcac107344dd2fcc3bd0504a53575c51 upstream.
+
+This is the opposite case of kernel bugzilla 216301.
+If we mmap a file using cache=none and then proceed to update the mmapped
+area these updates are not reflected in a later pread() of that part of the
+file.
+To fix this we must first destage any dirty pages in the range before
+we allow the pread() to proceed.
+
+Cc: stable@vger.kernel.org
+Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
+Reviewed-by: Enzo Matsumiya <ematsumiya@suse.de>
+Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/cifs/file.c |    9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+--- a/fs/cifs/file.c
++++ b/fs/cifs/file.c
+@@ -2827,6 +2827,15 @@ ssize_t cifs_user_writev(struct kiocb *i
+               return rc;
+       }
++      if (direct) {
++              rc = filemap_write_and_wait_range(file->f_inode->i_mapping,
++                                                offset, offset + len - 1);
++              if (rc) {
++                      kref_put(&ctx->refcount, cifs_aio_ctx_release);
++                      return -EAGAIN;
++              }
++      }
++
+       /* grab a lock here due to read response handlers can access ctx */
+       mutex_lock(&ctx->aio_mutex);
diff --git a/queue-4.14/iio-dac-ad5593r-fix-i2c-read-protocol-requirements.patch b/queue-4.14/iio-dac-ad5593r-fix-i2c-read-protocol-requirements.patch
new file mode 100644 (file)
index 0000000..c7b51c8
--- /dev/null
@@ -0,0 +1,113 @@
+From 558a25f903b4af6361b7fbeea08a6446a0745653 Mon Sep 17 00:00:00 2001
+From: Michael Hennerich <michael.hennerich@analog.com>
+Date: Tue, 13 Sep 2022 09:34:12 +0200
+Subject: iio: dac: ad5593r: Fix i2c read protocol requirements
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Michael Hennerich <michael.hennerich@analog.com>
+
+commit 558a25f903b4af6361b7fbeea08a6446a0745653 upstream.
+
+For reliable operation across the full range of supported
+interface rates, the AD5593R needs a STOP condition between
+address write, and data read (like show in the datasheet Figure 40)
+so in turn i2c_smbus_read_word_swapped cannot be used.
+
+While at it, a simple helper was added to make the code simpler.
+
+Fixes: 56ca9db862bf ("iio: dac: Add support for the AD5592R/AD5593R ADCs/DACs")
+Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
+Signed-off-by: Nuno Sá <nuno.sa@analog.com>
+Cc: <Stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20220913073413.140475-2-nuno.sa@analog.com
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/dac/ad5593r.c |   46 +++++++++++++++++++++++++++-------------------
+ 1 file changed, 27 insertions(+), 19 deletions(-)
+
+--- a/drivers/iio/dac/ad5593r.c
++++ b/drivers/iio/dac/ad5593r.c
+@@ -15,6 +15,8 @@
+ #include <linux/of.h>
+ #include <linux/acpi.h>
++#include <asm/unaligned.h>
++
+ #define AD5593R_MODE_CONF             (0 << 4)
+ #define AD5593R_MODE_DAC_WRITE                (1 << 4)
+ #define AD5593R_MODE_ADC_READBACK     (4 << 4)
+@@ -22,6 +24,24 @@
+ #define AD5593R_MODE_GPIO_READBACK    (6 << 4)
+ #define AD5593R_MODE_REG_READBACK     (7 << 4)
++static int ad5593r_read_word(struct i2c_client *i2c, u8 reg, u16 *value)
++{
++      int ret;
++      u8 buf[2];
++
++      ret = i2c_smbus_write_byte(i2c, reg);
++      if (ret < 0)
++              return ret;
++
++      ret = i2c_master_recv(i2c, buf, sizeof(buf));
++      if (ret < 0)
++              return ret;
++
++      *value = get_unaligned_be16(buf);
++
++      return 0;
++}
++
+ static int ad5593r_write_dac(struct ad5592r_state *st, unsigned chan, u16 value)
+ {
+       struct i2c_client *i2c = to_i2c_client(st->dev);
+@@ -40,13 +60,7 @@ static int ad5593r_read_adc(struct ad559
+       if (val < 0)
+               return (int) val;
+-      val = i2c_smbus_read_word_swapped(i2c, AD5593R_MODE_ADC_READBACK);
+-      if (val < 0)
+-              return (int) val;
+-
+-      *value = (u16) val;
+-
+-      return 0;
++      return ad5593r_read_word(i2c, AD5593R_MODE_ADC_READBACK, value);
+ }
+ static int ad5593r_reg_write(struct ad5592r_state *st, u8 reg, u16 value)
+@@ -60,25 +74,19 @@ static int ad5593r_reg_write(struct ad55
+ static int ad5593r_reg_read(struct ad5592r_state *st, u8 reg, u16 *value)
+ {
+       struct i2c_client *i2c = to_i2c_client(st->dev);
+-      s32 val;
+-
+-      val = i2c_smbus_read_word_swapped(i2c, AD5593R_MODE_REG_READBACK | reg);
+-      if (val < 0)
+-              return (int) val;
+-      *value = (u16) val;
+-
+-      return 0;
++      return ad5593r_read_word(i2c, AD5593R_MODE_REG_READBACK | reg, value);
+ }
+ static int ad5593r_gpio_read(struct ad5592r_state *st, u8 *value)
+ {
+       struct i2c_client *i2c = to_i2c_client(st->dev);
+-      s32 val;
++      u16 val;
++      int ret;
+-      val = i2c_smbus_read_word_swapped(i2c, AD5593R_MODE_GPIO_READBACK);
+-      if (val < 0)
+-              return (int) val;
++      ret = ad5593r_read_word(i2c, AD5593R_MODE_GPIO_READBACK, &val);
++      if (ret)
++              return ret;
+       *value = (u8) val;
index bc20de350d383a07133317d38611473c033a5508..e5fbce0e8e3d418a918c1be533ecc6c55869be8f 100644 (file)
@@ -51,4 +51,6 @@ alsa-oss-fix-potential-deadlock-at-unregistration.patch
 alsa-rawmidi-drop-register_mutex-in-snd_rawmidi_free.patch
 alsa-usb-audio-fix-potential-memory-leaks.patch
 alsa-usb-audio-fix-null-dererence-at-error-path.patch
+cifs-destage-dirty-pages-before-re-reading-them-for-cache-none.patch
+iio-dac-ad5593r-fix-i2c-read-protocol-requirements.patch
 revert-fs-check-fmode_lseek-to-control-internal-pipe.patch