]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.9
authorSasha Levin <sashal@kernel.org>
Sun, 7 Mar 2021 23:08:24 +0000 (18:08 -0500)
committerSasha Levin <sashal@kernel.org>
Sun, 7 Mar 2021 23:08:24 +0000 (18:08 -0500)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.9/alsa-ctxfi-cthw20k2-fix-mask-on-conf-to-allow-4-bits.patch [new file with mode: 0644]
queue-4.9/rsxx-return-efault-if-copy_to_user-fails.patch [new file with mode: 0644]
queue-4.9/series

diff --git a/queue-4.9/alsa-ctxfi-cthw20k2-fix-mask-on-conf-to-allow-4-bits.patch b/queue-4.9/alsa-ctxfi-cthw20k2-fix-mask-on-conf-to-allow-4-bits.patch
new file mode 100644 (file)
index 0000000..9a16ec8
--- /dev/null
@@ -0,0 +1,46 @@
+From 19fde3f08aae4b3aa1163aafd447fa9ef192b23e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 27 Feb 2021 00:15:27 +0000
+Subject: ALSA: ctxfi: cthw20k2: fix mask on conf to allow 4 bits
+
+From: Colin Ian King <colin.king@canonical.com>
+
+[ Upstream commit 26a9630c72ebac7c564db305a6aee54a8edde70e ]
+
+Currently the mask operation on variable conf is just 3 bits so
+the switch statement case value of 8 is unreachable dead code.
+The function daio_mgr_dao_init can be passed a 4 bit value,
+function dao_rsc_init calls it with conf set to:
+
+     conf = (desc->msr & 0x7) | (desc->passthru << 3);
+
+so clearly when desc->passthru is set to 1 then conf can be
+at least 8.
+
+Fix this by changing the mask to 0xf.
+
+Fixes: 8cc72361481f ("ALSA: SB X-Fi driver merge")
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+Link: https://lore.kernel.org/r/20210227001527.1077484-1-colin.king@canonical.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/ctxfi/cthw20k2.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/sound/pci/ctxfi/cthw20k2.c b/sound/pci/ctxfi/cthw20k2.c
+index 18ee7768b7c4..ae8aa10a4a5d 100644
+--- a/sound/pci/ctxfi/cthw20k2.c
++++ b/sound/pci/ctxfi/cthw20k2.c
+@@ -995,7 +995,7 @@ static int daio_mgr_dao_init(void *blk, unsigned int idx, unsigned int conf)
+       if (idx < 4) {
+               /* S/PDIF output */
+-              switch ((conf & 0x7)) {
++              switch ((conf & 0xf)) {
+               case 1:
+                       set_field(&ctl->txctl[idx], ATXCTL_NUC, 0);
+                       break;
+-- 
+2.30.1
+
diff --git a/queue-4.9/rsxx-return-efault-if-copy_to_user-fails.patch b/queue-4.9/rsxx-return-efault-if-copy_to_user-fails.patch
new file mode 100644 (file)
index 0000000..339ac82
--- /dev/null
@@ -0,0 +1,50 @@
+From 150f9eb3ccd41dcdf0b1abd4c749eec19b7af611 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 3 Mar 2021 13:59:12 +0300
+Subject: rsxx: Return -EFAULT if copy_to_user() fails
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+[ Upstream commit 77516d25f54912a7baedeeac1b1b828b6f285152 ]
+
+The copy_to_user() function returns the number of bytes remaining but
+we want to return -EFAULT to the user if it can't complete the copy.
+The "st" variable only holds zero on success or negative error codes on
+failure so the type should be int.
+
+Fixes: 36f988e978f8 ("rsxx: Adding in debugfs entries.")
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/block/rsxx/core.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
+index 6beafaa335c7..97b678c0ea13 100644
+--- a/drivers/block/rsxx/core.c
++++ b/drivers/block/rsxx/core.c
+@@ -180,15 +180,17 @@ static ssize_t rsxx_cram_read(struct file *fp, char __user *ubuf,
+ {
+       struct rsxx_cardinfo *card = file_inode(fp)->i_private;
+       char *buf;
+-      ssize_t st;
++      int st;
+       buf = kzalloc(cnt, GFP_KERNEL);
+       if (!buf)
+               return -ENOMEM;
+       st = rsxx_creg_read(card, CREG_ADD_CRAM + (u32)*ppos, cnt, buf, 1);
+-      if (!st)
+-              st = copy_to_user(ubuf, buf, cnt);
++      if (!st) {
++              if (copy_to_user(ubuf, buf, cnt))
++                      st = -EFAULT;
++      }
+       kfree(buf);
+       if (st)
+               return st;
+-- 
+2.30.1
+
index 813ecec41a81c62b29b626c7a4b215069a3c54a1..60d0426cbca2be2d264d9b45073ef81bf1ea51b8 100644 (file)
@@ -1,3 +1,5 @@
 btrfs-raid56-simplify-tracking-of-q-stripe-presence.patch
 btrfs-fix-raid6-qstripe-kmap.patch
 usbip-tools-fix-build-error-for-multiple-definition.patch
+alsa-ctxfi-cthw20k2-fix-mask-on-conf-to-allow-4-bits.patch
+rsxx-return-efault-if-copy_to_user-fails.patch