From: Jann Horn <jannh(a)google.com>
Subject: reiserfs: fix broken xattr handling (heap corruption, bad retval)
This fixes the following issues:
- When a buffer size is supplied to reiserfs_listxattr() such that each
individual name fits, but the concatenation of all names doesn't fit,
reiserfs_listxattr() overflows the supplied buffer. This leads to a
kernel heap overflow (verified using KASAN) followed by an out-of-bounds
usercopy and is therefore a security bug.
- When a buffer size is supplied to reiserfs_listxattr() such that a
name doesn't fit, -ERANGE should be returned. But reiserfs instead just
truncates the list of names; I have verified that if the only xattr on a
file has a longer name than the supplied buffer length, listxattr()
incorrectly returns zero.
With my patch applied, -ERANGE is returned in both cases and the memory
corruption doesn't happen anymore.
Credit for making me clean this code up a bit goes to Al Viro, who pointed
out that the ->actor calling convention is suboptimal and should be
changed.
Link: http://lkml.kernel.org/r/20180802151539.5373-1-jannh@google.com
Fixes: 48b32a3553a5 ("reiserfs: use generic xattr handlers")
Signed-off-by: Jann Horn <jannh(a)google.com>
Acked-by: Jeff Mahoney <jeffm(a)suse.com>
Cc: Eric Biggers <ebiggers(a)google.com>
Cc: Al Viro <viro(a)zeniv.linux.org.uk>
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Andrew Morton <akpm(a)linux-foundation.org>
---
fs/reiserfs/xattr.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/fs/reiserfs/xattr.c~reiserfs-fix-broken-xattr-handling-heap-corruption-bad-retval
+++ a/fs/reiserfs/xattr.c
@@ -792,8 +792,10 @@ static int listxattr_filler(struct dir_c
return 0;
size = namelen + 1;
if (b->buf) {
- if (size > b->size)
+ if (b->pos + size > b->size) {
+ b->pos = -ERANGE;
return -ERANGE;
+ }
memcpy(b->buf + b->pos, name, namelen);
b->buf[b->pos + namelen] = 0;
}
_
From: Peter Kalauskas <peskal(a)google.com>
Subject: drivers/block/zram/zram_drv.c: fix bug storing backing_dev
The call to strlcpy in backing_dev_store is incorrect. It should take
the size of the destination buffer instead of the size of the source
buffer. Additionally, ignore the newline character (\n) when reading
the new file_name buffer. This makes it possible to set the backing_dev
as follows:
echo /dev/sdX > /sys/block/zram0/backing_dev
The reason it worked before was the fact that strlcpy() copies 'len - 1'
bytes, which is strlen(buf) - 1 in our case, so it accidentally didn't
copy the trailing new line symbol. Which also means that "echo -n
/dev/sdX" most likely was broken.
Signed-off-by: Peter Kalauskas <peskal(a)google.com>
Link: http://lkml.kernel.org/r/20180813061623.GC64836@rodete-desktop-imager.corp.…
Acked-by: Minchan Kim <minchan(a)kernel.org>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>
Cc: <stable(a)vger.kernel.org> [4.14+]
Signed-off-by: Andrew Morton <akpm(a)linux-foundation.org>
---
drivers/block/zram/zram_drv.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
--- a/drivers/block/zram/zram_drv.c~zram-fix-bug-storing-backing_dev
+++ a/drivers/block/zram/zram_drv.c
@@ -337,6 +337,7 @@ static ssize_t backing_dev_store(struct
struct device_attribute *attr, const char *buf, size_t len)
{
char *file_name;
+ size_t sz;
struct file *backing_dev = NULL;
struct inode *inode;
struct address_space *mapping;
@@ -357,7 +358,11 @@ static ssize_t backing_dev_store(struct
goto out;
}
- strlcpy(file_name, buf, len);
+ strlcpy(file_name, buf, PATH_MAX);
+ /* ignore trailing newline */
+ sz = strlen(file_name);
+ if (sz > 0 && file_name[sz - 1] == '\n')
+ file_name[sz - 1] = 0x00;
backing_dev = filp_open(file_name, O_RDWR|O_LARGEFILE, 0);
if (IS_ERR(backing_dev)) {
_
We need that to adjust the len of the 2nd transfer (called data in spi-mem)
if it's too long to fit in a SPI message or SPI transfer.
Fixes: c36ff266dc82 ("spi: Extend the core to ease integration of SPI memory controllers")
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Chuanhua Han <chuanhua.han(a)nxp.com>
Suggested-by: Boris Brezillon <boris.brezillon(a)bootlin.com>
---
Changes in v5:
-Add the validation check after the op->data.nbytes assignment
-Assign the "len" variable after defining it
Changes in v4:
-Rename variable name "opcode_addr_dummy_sum" to "len".
-The comparison of "spi_max_message_size(mem->spi)" and "len" was removed.
-Adjust their order when comparing the sizes of "spi_max_message_size(mem->spi)" and "len"
-Changing the "unsigned long" type in the code to "size_t"
Changes in v3:
-Rename variable name "val" to "opcode_addr_dummy_sum".
-Place the legitimacy of the transfer size(i.e., "spi_max_message_size(mem->spi)" and
-"opcode_addr_dummy_sum") into "if (! ctlr - > mem_ops | |! ctlr-> mem_ops->exec_op) {"
structure and add "spi_max_transfer_size(mem->spi) and opcode_addr_dummy_sum".
-Adjust the formatting alignment of the code.
-"(unsigned long)op->data.nbytes" was modified to "(unsigned long)(op->data.nbytes)".
Changes in v2:
-Place the adjusted transfer bytes code in spi_mem_adjust_op_size() and check
spi_max_message_size(mem->spi) value before subtracting opcode, addr and dummy bytes.
-Change the code from fsl-espi controller to generic code(The adjustment of spi transmission
length was originally modified in the "drivers/spi/spi-fsl-espi.c" file, and now the adjustment
of transfer length is made in the "drivers/spi/spi-mem.c" file)
drivers/spi/spi-mem.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
index 990770d..6184fa1 100644
--- a/drivers/spi/spi-mem.c
+++ b/drivers/spi/spi-mem.c
@@ -328,10 +328,26 @@ EXPORT_SYMBOL_GPL(spi_mem_exec_op);
int spi_mem_adjust_op_size(struct spi_mem *mem, struct spi_mem_op *op)
{
struct spi_controller *ctlr = mem->spi->controller;
+ size_t len;
+
+ len = sizeof(op->cmd.opcode) + op->addr.nbytes + op->dummy.nbytes;
if (ctlr->mem_ops && ctlr->mem_ops->adjust_op_size)
return ctlr->mem_ops->adjust_op_size(mem, op);
+ if (!ctlr->mem_ops || !ctlr->mem_ops->exec_op) {
+ if (len > spi_max_transfer_size(mem->spi))
+ return -EINVAL;
+
+ op->data.nbytes = min3((size_t)(op->data.nbytes),
+ spi_max_transfer_size(mem->spi),
+ spi_max_message_size(mem->spi) -
+ len);
+
+ if (!op->data.nbytes)
+ return -EINVAL;
+ }
+
return 0;
}
EXPORT_SYMBOL_GPL(spi_mem_adjust_op_size);
--
2.7.4
This is the start of the stable review cycle for the 4.4.151 release.
There are 22 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Thu Aug 23 05:51:31 UTC 2018.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.151-rc…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.4.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 4.4.151-rc1
Kees Cook <keescook(a)chromium.org>
isdn: Disable IIOCDBGVAR
Sudip Mukherjee <sudipm.mukherjee(a)gmail.com>
Bluetooth: avoid killing an already killed socket
Tom Lendacky <thomas.lendacky(a)amd.com>
x86/mm: Simplify p[g4um]d_page() macros
Chen Hu <hu1.chen(a)intel.com>
serial: 8250_dw: always set baud rate in dw8250_set_termios
Willy Tarreau <w(a)1wt.eu>
ACPI / PM: save NVS memory for ASUS 1025C laptop
Zhang Rui <rui.zhang(a)intel.com>
ACPI: save NVS memory for Lenovo G50-45
Aleksander Morgado <aleksander(a)aleksander.es>
USB: option: add support for DW5821e
John Ogness <john.ogness(a)linutronix.de>
USB: serial: sierra: fix potential deadlock at close
Takashi Iwai <tiwai(a)suse.de>
ALSA: vxpocket: Fix invalid endian conversions
Takashi Iwai <tiwai(a)suse.de>
ALSA: memalloc: Don't exceed over the requested size
Hans de Goede <hdegoede(a)redhat.com>
ALSA: hda: Correct Asrock B85M-ITX power_save blacklist entry
Takashi Iwai <tiwai(a)suse.de>
ALSA: cs5535audio: Fix invalid endian conversion
Takashi Iwai <tiwai(a)suse.de>
ALSA: virmidi: Fix too long output trigger loop
Takashi Iwai <tiwai(a)suse.de>
ALSA: vx222: Fix invalid endian conversions
Park Ju Hyung <qkrwngud825(a)gmail.com>
ALSA: hda - Turn CX8200 into D3 as well upon reboot
Park Ju Hyung <qkrwngud825(a)gmail.com>
ALSA: hda - Sleep for 10ms after entering D3 on Conexant codecs
Hangbin Liu <liuhangbin(a)gmail.com>
net_sched: fix NULL pointer dereference when delete tcindex filter
Cong Wang <xiyou.wangcong(a)gmail.com>
vsock: split dwork to avoid reinitializations
Hangbin Liu <liuhangbin(a)gmail.com>
net_sched: Fix missing res info when create new tc_index filter
Cong Wang <xiyou.wangcong(a)gmail.com>
llc: use refcount_inc_not_zero() for llc_sap_find()
Wei Wang <weiwan(a)google.com>
l2tp: use sk_dst_check() to avoid race on sk->sk_dst_cache
Alexey Kodanev <alexey.kodanev(a)oracle.com>
dccp: fix undefined behavior with 'cwnd' shift in ccid2_cwnd_restart()
-------------
Diffstat:
Makefile | 4 ++--
arch/x86/include/asm/pgtable.h | 13 ++++++++-----
drivers/acpi/sleep.c | 27 +++++++++++++++++++++++++++
drivers/isdn/i4l/isdn_common.c | 8 +-------
drivers/tty/serial/8250/8250_dw.c | 2 +-
drivers/usb/serial/option.c | 4 ++++
drivers/usb/serial/sierra.c | 4 ++--
include/net/af_vsock.h | 4 ++--
include/net/llc.h | 5 +++++
net/bluetooth/sco.c | 3 ++-
net/dccp/ccids/ccid2.c | 6 ++++--
net/l2tp/l2tp_core.c | 2 +-
net/llc/llc_core.c | 4 ++--
net/sched/cls_tcindex.c | 8 +++-----
net/vmw_vsock/af_vsock.c | 15 ++++++++-------
net/vmw_vsock/vmci_transport.c | 3 +--
sound/core/memalloc.c | 8 ++------
sound/core/seq/seq_virmidi.c | 10 ++++++++++
sound/pci/cs5535audio/cs5535audio.h | 6 +++---
sound/pci/cs5535audio/cs5535audio_pcm.c | 4 ++--
sound/pci/hda/hda_intel.c | 2 +-
sound/pci/hda/patch_conexant.c | 4 +++-
sound/pci/vx222/vx222_ops.c | 8 ++++----
sound/pcmcia/vx/vxp_ops.c | 10 +++++-----
24 files changed, 103 insertions(+), 61 deletions(-)
This is the start of the stable review cycle for the 4.9.123 release.
There are 25 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Thu Aug 23 05:51:15 UTC 2018.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.123-rc…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.9.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 4.9.123-rc1
Sudip Mukherjee <sudipm.mukherjee(a)gmail.com>
Bluetooth: avoid killing an already killed socket
Tom Lendacky <thomas.lendacky(a)amd.com>
x86/mm: Simplify p[g4um]d_page() macros
Srinath Mannam <srinath.mannam(a)broadcom.com>
serial: 8250_dw: Add ACPI support for uart on Broadcom SoC
Chen Hu <hu1.chen(a)intel.com>
serial: 8250_dw: always set baud rate in dw8250_set_termios
Mark <dmarkh(a)cfl.rr.com>
tty: serial: 8250: Revert NXP SC16C2552 workaround
Willy Tarreau <w(a)1wt.eu>
ACPI / PM: save NVS memory for ASUS 1025C laptop
Aleksander Morgado <aleksander(a)aleksander.es>
USB: option: add support for DW5821e
John Ogness <john.ogness(a)linutronix.de>
USB: serial: sierra: fix potential deadlock at close
Hangbin Liu <liuhangbin(a)gmail.com>
cls_matchall: fix tcf_unbind_filter missing
Kees Cook <keescook(a)chromium.org>
isdn: Disable IIOCDBGVAR
Takashi Iwai <tiwai(a)suse.de>
ALSA: vxpocket: Fix invalid endian conversions
Takashi Iwai <tiwai(a)suse.de>
ALSA: memalloc: Don't exceed over the requested size
Hans de Goede <hdegoede(a)redhat.com>
ALSA: hda: Correct Asrock B85M-ITX power_save blacklist entry
Takashi Iwai <tiwai(a)suse.de>
ALSA: cs5535audio: Fix invalid endian conversion
Takashi Iwai <tiwai(a)suse.de>
ALSA: virmidi: Fix too long output trigger loop
Takashi Iwai <tiwai(a)suse.de>
ALSA: vx222: Fix invalid endian conversions
Park Ju Hyung <qkrwngud825(a)gmail.com>
ALSA: hda - Turn CX8200 into D3 as well upon reboot
Park Ju Hyung <qkrwngud825(a)gmail.com>
ALSA: hda - Sleep for 10ms after entering D3 on Conexant codecs
Hangbin Liu <liuhangbin(a)gmail.com>
net_sched: fix NULL pointer dereference when delete tcindex filter
Hangbin Liu <liuhangbin(a)gmail.com>
net_sched: Fix missing res info when create new tc_index filter
Xin Long <lucien.xin(a)gmail.com>
ip6_tunnel: use the right value for ipv4 min mtu check in ip6_tnl_xmit
Cong Wang <xiyou.wangcong(a)gmail.com>
vsock: split dwork to avoid reinitializations
Cong Wang <xiyou.wangcong(a)gmail.com>
llc: use refcount_inc_not_zero() for llc_sap_find()
Wei Wang <weiwan(a)google.com>
l2tp: use sk_dst_check() to avoid race on sk->sk_dst_cache
Alexey Kodanev <alexey.kodanev(a)oracle.com>
dccp: fix undefined behavior with 'cwnd' shift in ccid2_cwnd_restart()
-------------
Diffstat:
Makefile | 4 ++--
arch/x86/include/asm/pgtable.h | 13 ++++++++-----
drivers/acpi/sleep.c | 8 ++++++++
drivers/isdn/i4l/isdn_common.c | 8 +-------
drivers/tty/serial/8250/8250_dw.c | 3 ++-
drivers/tty/serial/8250/8250_port.c | 3 +--
drivers/usb/serial/option.c | 4 ++++
drivers/usb/serial/sierra.c | 4 ++--
include/net/af_vsock.h | 4 ++--
include/net/llc.h | 5 +++++
net/bluetooth/sco.c | 3 ++-
net/dccp/ccids/ccid2.c | 6 ++++--
net/ipv6/ip6_tunnel.c | 8 ++------
net/l2tp/l2tp_core.c | 2 +-
net/llc/llc_core.c | 4 ++--
net/sched/cls_matchall.c | 2 ++
net/sched/cls_tcindex.c | 8 +++-----
net/vmw_vsock/af_vsock.c | 15 ++++++++-------
net/vmw_vsock/vmci_transport.c | 3 +--
sound/core/memalloc.c | 8 ++------
sound/core/seq/seq_virmidi.c | 10 ++++++++++
sound/pci/cs5535audio/cs5535audio.h | 6 +++---
sound/pci/cs5535audio/cs5535audio_pcm.c | 4 ++--
sound/pci/hda/hda_intel.c | 2 +-
sound/pci/hda/patch_conexant.c | 4 +++-
sound/pci/vx222/vx222_ops.c | 8 ++++----
sound/pcmcia/vx/vxp_ops.c | 10 +++++-----
27 files changed, 90 insertions(+), 69 deletions(-)
Userspace can cause the kref to handles to increment
arbitrarily high. Ensure it does not overflow.
Signed-off-by: Daniel Rosenberg <drosen(a)google.com>
---
v2: Fixed patch corruption :(
This patch is against 4.4. It does not apply to master due to a large
rework of ion in 4.12 which removed the affected functions altogther.
4c23cbff073f3b9b ("staging: android: ion: Remove import interface")
It applies from 3.18 to 4.11, although with a trivial conflict resolution
for the later branches.
drivers/staging/android/ion/ion.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index 374f840f31a48..47cb163da9a07 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -15,6 +15,7 @@
*
*/
+#include <linux/atomic.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/file.h>
@@ -387,6 +388,16 @@ static void ion_handle_get(struct ion_handle *handle)
kref_get(&handle->ref);
}
+/* Must hold the client lock */
+static struct ion_handle *ion_handle_get_check_overflow(
+ struct ion_handle *handle)
+{
+ if (atomic_read(&handle->ref.refcount) + 1 == 0)
+ return ERR_PTR(-EOVERFLOW);
+ ion_handle_get(handle);
+ return handle;
+}
+
static int ion_handle_put_nolock(struct ion_handle *handle)
{
int ret;
@@ -433,9 +444,9 @@ static struct ion_handle *ion_handle_get_by_id_nolock(struct ion_client *client,
handle = idr_find(&client->idr, id);
if (handle)
- ion_handle_get(handle);
+ return ion_handle_get_check_overflow(handle);
- return handle ? handle : ERR_PTR(-EINVAL);
+ return ERR_PTR(-EINVAL);
}
struct ion_handle *ion_handle_get_by_id(struct ion_client *client,
@@ -1202,7 +1213,7 @@ struct ion_handle *ion_import_dma_buf(struct ion_client *client, int fd)
/* if a handle exists for this buffer just take a reference to it */
handle = ion_handle_lookup(client, buffer);
if (!IS_ERR(handle)) {
- ion_handle_get(handle);
+ handle = ion_handle_get_check_overflow(handle);
mutex_unlock(&client->lock);
goto end;
}
--
2.18.0.865.gffc8e1a3cd6-goog
This is the start of the stable review cycle for the 4.18.4 release.
There are 35 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Thu Aug 23 05:50:07 UTC 2018.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.18.4-rc1…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.18.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 4.18.4-rc1
Hangbin Liu <liuhangbin(a)gmail.com>
cls_matchall: fix tcf_unbind_filter missing
Jisheng Zhang <Jisheng.Zhang(a)synaptics.com>
net: mvneta: fix mvneta_config_rss on armada 3700
Andrew Lunn <andrew(a)lunn.ch>
net: ethernet: mvneta: Fix napi structure mixup on armada 3700
Haishuang Yan <yanhaishuang(a)cmss.chinamobile.com>
ip_vti: fix a null pointer deferrence when create vti fallback tunnel
Jian-Hong Pan <jian-hong(a)endlessm.com>
r8169: don't use MSI-X on RTL8106e
Takashi Iwai <tiwai(a)suse.de>
hv/netvsc: Fix NULL dereference at single queue mode fallback
Jeremy Cline <jcline(a)redhat.com>
net: sock_diag: Fix spectre v1 gadget in __sock_diag_cmd()
Kees Cook <keescook(a)chromium.org>
isdn: Disable IIOCDBGVAR
Sudip Mukherjee <sudipm.mukherjee(a)gmail.com>
Bluetooth: avoid killing an already killed socket
Xiubo Li <xiubli(a)redhat.com>
Revert "uio: use request_threaded_irq instead"
Johan Hovold <johan(a)kernel.org>
misc: sram: fix resource leaks in probe error path
Hailong Liu <liu.hailong6(a)zte.com.cn>
uio: fix wrong return value from uio_mmap()
Srinath Mannam <srinath.mannam(a)broadcom.com>
serial: 8250_dw: Add ACPI support for uart on Broadcom SoC
Chen Hu <hu1.chen(a)intel.com>
serial: 8250_dw: always set baud rate in dw8250_set_termios
Aaron Sierra <asierra(a)xes-inc.com>
serial: 8250_exar: Read INT0 from slave device, too
Mark <dmarkh(a)cfl.rr.com>
tty: serial: 8250: Revert NXP SC16C2552 workaround
Willy Tarreau <w(a)1wt.eu>
ACPI / PM: save NVS memory for ASUS 1025C laptop
Aleksander Morgado <aleksander(a)aleksander.es>
USB: option: add support for DW5821e
Movie Song <MovieSong(a)aten-itlab.cn>
USB: serial: pl2303: add a new device id for ATEN
John Ogness <john.ogness(a)linutronix.de>
USB: serial: sierra: fix potential deadlock at close
Mika Båtsman <mika.batsman(a)gmail.com>
media: gl861: fix probe of dvb_usb_gl861
Takashi Iwai <tiwai(a)suse.de>
ALSA: seq: Fix poll() error return
Takashi Iwai <tiwai(a)suse.de>
ALSA: vxpocket: Fix invalid endian conversions
Takashi Iwai <tiwai(a)suse.de>
ALSA: memalloc: Don't exceed over the requested size
Hans de Goede <hdegoede(a)redhat.com>
ALSA: hda: Correct Asrock B85M-ITX power_save blacklist entry
Takashi Sakamoto <o-takashi(a)sakamocchi.jp>
ALSA: dice: fix wrong copy to rx parameters for Alesis iO26
Takashi Iwai <tiwai(a)suse.de>
ALSA: cs5535audio: Fix invalid endian conversion
Takashi Iwai <tiwai(a)suse.de>
ALSA: virmidi: Fix too long output trigger loop
Takashi Iwai <tiwai(a)suse.de>
ALSA: vx222: Fix invalid endian conversions
Park Ju Hyung <qkrwngud825(a)gmail.com>
ALSA: hda - Turn CX8200 into D3 as well upon reboot
Park Ju Hyung <qkrwngud825(a)gmail.com>
ALSA: hda - Sleep for 10ms after entering D3 on Conexant codecs
Heiner Kallweit <hkallweit1(a)gmail.com>
r8169: don't use MSI-X on RTL8168g
Hangbin Liu <liuhangbin(a)gmail.com>
net_sched: Fix missing res info when create new tc_index filter
Hangbin Liu <liuhangbin(a)gmail.com>
net_sched: fix NULL pointer dereference when delete tcindex filter
Wei Wang <weiwan(a)google.com>
l2tp: use sk_dst_check() to avoid race on sk->sk_dst_cache
-------------
Diffstat:
Makefile | 4 +--
drivers/acpi/sleep.c | 8 +++++
drivers/isdn/i4l/isdn_common.c | 8 +----
drivers/media/usb/dvb-usb-v2/gl861.c | 21 +++++++------
drivers/misc/sram.c | 9 +++++-
drivers/net/ethernet/marvell/mvneta.c | 53 ++++++++++++++++++++-------------
drivers/net/ethernet/realtek/r8169.c | 12 ++++++--
drivers/net/hyperv/rndis_filter.c | 2 +-
drivers/tty/serial/8250/8250_dw.c | 3 +-
drivers/tty/serial/8250/8250_exar.c | 6 +++-
drivers/tty/serial/8250/8250_port.c | 3 +-
drivers/uio/uio.c | 10 ++-----
drivers/usb/serial/option.c | 4 +++
drivers/usb/serial/pl2303.c | 2 ++
drivers/usb/serial/pl2303.h | 1 +
drivers/usb/serial/sierra.c | 4 +--
net/bluetooth/sco.c | 3 +-
net/core/sock_diag.c | 2 ++
net/ipv4/ip_vti.c | 3 +-
net/l2tp/l2tp_core.c | 2 +-
net/sched/cls_matchall.c | 2 ++
net/sched/cls_tcindex.c | 8 ++---
net/socket.c | 3 +-
sound/core/memalloc.c | 8 ++---
sound/core/seq/oss/seq_oss.c | 2 +-
sound/core/seq/seq_clientmgr.c | 2 +-
sound/core/seq/seq_virmidi.c | 10 +++++++
sound/firewire/dice/dice-alesis.c | 2 +-
sound/pci/cs5535audio/cs5535audio.h | 6 ++--
sound/pci/cs5535audio/cs5535audio_pcm.c | 4 +--
sound/pci/hda/hda_intel.c | 2 +-
sound/pci/hda/patch_conexant.c | 4 ++-
sound/pci/vx222/vx222_ops.c | 8 ++---
sound/pcmcia/vx/vxp_ops.c | 10 +++----
34 files changed, 138 insertions(+), 93 deletions(-)
This is the start of the stable review cycle for the 4.14.66 release.
There are 29 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Thu Aug 23 05:50:58 UTC 2018.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.66-rc…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.14.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 4.14.66-rc1
Hangbin Liu <liuhangbin(a)gmail.com>
cls_matchall: fix tcf_unbind_filter missing
Kees Cook <keescook(a)chromium.org>
isdn: Disable IIOCDBGVAR
Sudip Mukherjee <sudipm.mukherjee(a)gmail.com>
Bluetooth: avoid killing an already killed socket
Johan Hovold <johan(a)kernel.org>
misc: sram: fix resource leaks in probe error path
Srinath Mannam <srinath.mannam(a)broadcom.com>
serial: 8250_dw: Add ACPI support for uart on Broadcom SoC
Chen Hu <hu1.chen(a)intel.com>
serial: 8250_dw: always set baud rate in dw8250_set_termios
Aaron Sierra <asierra(a)xes-inc.com>
serial: 8250_exar: Read INT0 from slave device, too
Mark <dmarkh(a)cfl.rr.com>
tty: serial: 8250: Revert NXP SC16C2552 workaround
Willy Tarreau <w(a)1wt.eu>
ACPI / PM: save NVS memory for ASUS 1025C laptop
Aleksander Morgado <aleksander(a)aleksander.es>
USB: option: add support for DW5821e
Movie Song <MovieSong(a)aten-itlab.cn>
USB: serial: pl2303: add a new device id for ATEN
John Ogness <john.ogness(a)linutronix.de>
USB: serial: sierra: fix potential deadlock at close
Takashi Iwai <tiwai(a)suse.de>
ALSA: vxpocket: Fix invalid endian conversions
Takashi Iwai <tiwai(a)suse.de>
ALSA: memalloc: Don't exceed over the requested size
Hans de Goede <hdegoede(a)redhat.com>
ALSA: hda: Correct Asrock B85M-ITX power_save blacklist entry
Takashi Iwai <tiwai(a)suse.de>
ALSA: cs5535audio: Fix invalid endian conversion
Takashi Iwai <tiwai(a)suse.de>
ALSA: virmidi: Fix too long output trigger loop
Takashi Iwai <tiwai(a)suse.de>
ALSA: vx222: Fix invalid endian conversions
Park Ju Hyung <qkrwngud825(a)gmail.com>
ALSA: hda - Turn CX8200 into D3 as well upon reboot
Park Ju Hyung <qkrwngud825(a)gmail.com>
ALSA: hda - Sleep for 10ms after entering D3 on Conexant codecs
Dmitry Bogdanov <dmitry.bogdanov(a)aquantia.com>
net: aquantia: Fix IFF_ALLMULTI flag functionality
Xin Long <lucien.xin(a)gmail.com>
ip6_tunnel: use the right value for ipv4 min mtu check in ip6_tnl_xmit
Jason Wang <jasowang(a)redhat.com>
vhost: reset metadata cache when initializing new IOTLB
Hangbin Liu <liuhangbin(a)gmail.com>
net_sched: Fix missing res info when create new tc_index filter
Cong Wang <xiyou.wangcong(a)gmail.com>
vsock: split dwork to avoid reinitializations
Hangbin Liu <liuhangbin(a)gmail.com>
net_sched: fix NULL pointer dereference when delete tcindex filter
Cong Wang <xiyou.wangcong(a)gmail.com>
llc: use refcount_inc_not_zero() for llc_sap_find()
Wei Wang <weiwan(a)google.com>
l2tp: use sk_dst_check() to avoid race on sk->sk_dst_cache
Alexey Kodanev <alexey.kodanev(a)oracle.com>
dccp: fix undefined behavior with 'cwnd' shift in ccid2_cwnd_restart()
-------------
Diffstat:
Makefile | 4 ++--
drivers/acpi/sleep.c | 8 ++++++++
drivers/isdn/i4l/isdn_common.c | 8 +-------
drivers/misc/sram.c | 9 ++++++++-
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 2 +-
drivers/tty/serial/8250/8250_dw.c | 3 ++-
drivers/tty/serial/8250/8250_exar.c | 6 +++++-
drivers/tty/serial/8250/8250_port.c | 3 +--
drivers/usb/serial/option.c | 4 ++++
drivers/usb/serial/pl2303.c | 2 ++
drivers/usb/serial/pl2303.h | 1 +
drivers/usb/serial/sierra.c | 4 ++--
drivers/vhost/vhost.c | 9 ++++++---
include/net/af_vsock.h | 4 ++--
include/net/llc.h | 5 +++++
net/bluetooth/sco.c | 3 ++-
net/dccp/ccids/ccid2.c | 6 ++++--
net/ipv6/ip6_tunnel.c | 8 ++------
net/l2tp/l2tp_core.c | 2 +-
net/llc/llc_core.c | 4 ++--
net/sched/cls_matchall.c | 2 ++
net/sched/cls_tcindex.c | 8 +++-----
net/vmw_vsock/af_vsock.c | 15 ++++++++-------
net/vmw_vsock/vmci_transport.c | 3 +--
sound/core/memalloc.c | 8 ++------
sound/core/seq/seq_virmidi.c | 10 ++++++++++
sound/pci/cs5535audio/cs5535audio.h | 6 +++---
sound/pci/cs5535audio/cs5535audio_pcm.c | 4 ++--
sound/pci/hda/hda_intel.c | 2 +-
sound/pci/hda/patch_conexant.c | 4 +++-
sound/pci/vx222/vx222_ops.c | 8 ++++----
sound/pcmcia/vx/vxp_ops.c | 10 +++++-----
32 files changed, 105 insertions(+), 70 deletions(-)
This is the start of the stable review cycle for the 4.17.18 release.
There are 42 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Thu Aug 23 05:50:04 UTC 2018.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.17.18-rc…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.17.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 4.17.18-rc1
Jisheng Zhang <Jisheng.Zhang(a)synaptics.com>
net: mvneta: fix mvneta_config_rss on armada 3700
Andrew Lunn <andrew(a)lunn.ch>
net: ethernet: mvneta: Fix napi structure mixup on armada 3700
Hangbin Liu <liuhangbin(a)gmail.com>
cls_matchall: fix tcf_unbind_filter missing
Haishuang Yan <yanhaishuang(a)cmss.chinamobile.com>
ip_vti: fix a null pointer deferrence when create vti fallback tunnel
Jian-Hong Pan <jian-hong(a)endlessm.com>
r8169: don't use MSI-X on RTL8106e
Jeremy Cline <jcline(a)redhat.com>
net: sock_diag: Fix spectre v1 gadget in __sock_diag_cmd()
Kees Cook <keescook(a)chromium.org>
isdn: Disable IIOCDBGVAR
Sudip Mukherjee <sudipm.mukherjee(a)gmail.com>
Bluetooth: avoid killing an already killed socket
Johan Hovold <johan(a)kernel.org>
misc: sram: fix resource leaks in probe error path
Srinath Mannam <srinath.mannam(a)broadcom.com>
serial: 8250_dw: Add ACPI support for uart on Broadcom SoC
Chen Hu <hu1.chen(a)intel.com>
serial: 8250_dw: always set baud rate in dw8250_set_termios
Aaron Sierra <asierra(a)xes-inc.com>
serial: 8250_exar: Read INT0 from slave device, too
Mark <dmarkh(a)cfl.rr.com>
tty: serial: 8250: Revert NXP SC16C2552 workaround
Willy Tarreau <w(a)1wt.eu>
ACPI / PM: save NVS memory for ASUS 1025C laptop
Aleksander Morgado <aleksander(a)aleksander.es>
USB: option: add support for DW5821e
Movie Song <MovieSong(a)aten-itlab.cn>
USB: serial: pl2303: add a new device id for ATEN
John Ogness <john.ogness(a)linutronix.de>
USB: serial: sierra: fix potential deadlock at close
Takashi Iwai <tiwai(a)suse.de>
ALSA: seq: Fix poll() error return
Takashi Iwai <tiwai(a)suse.de>
ALSA: vxpocket: Fix invalid endian conversions
Takashi Iwai <tiwai(a)suse.de>
ALSA: memalloc: Don't exceed over the requested size
Hans de Goede <hdegoede(a)redhat.com>
ALSA: hda: Correct Asrock B85M-ITX power_save blacklist entry
Takashi Iwai <tiwai(a)suse.de>
ALSA: cs5535audio: Fix invalid endian conversion
Takashi Iwai <tiwai(a)suse.de>
ALSA: virmidi: Fix too long output trigger loop
Takashi Iwai <tiwai(a)suse.de>
ALSA: vx222: Fix invalid endian conversions
Park Ju Hyung <qkrwngud825(a)gmail.com>
ALSA: hda - Turn CX8200 into D3 as well upon reboot
Park Ju Hyung <qkrwngud825(a)gmail.com>
ALSA: hda - Sleep for 10ms after entering D3 on Conexant codecs
David Howells <dhowells(a)redhat.com>
rxrpc: Fix the keepalive generator [ver #2]
Heiner Kallweit <hkallweit1(a)gmail.com>
r8169: don't use MSI-X on RTL8168g
Or Gerlitz <ogerlitz(a)mellanox.com>
net/mlx5e: Properly check if hairpin is possible between two functions
Nir Dotan <nird(a)mellanox.com>
mlxsw: core_acl_flex_actions: Remove redundant mirror resource destruction
Nir Dotan <nird(a)mellanox.com>
mlxsw: core_acl_flex_actions: Remove redundant counter destruction
Nir Dotan <nird(a)mellanox.com>
mlxsw: core_acl_flex_actions: Remove redundant resource destruction
Xin Long <lucien.xin(a)gmail.com>
ip6_tunnel: use the right value for ipv4 min mtu check in ip6_tnl_xmit
Dmitry Bogdanov <dmitry.bogdanov(a)aquantia.com>
net: aquantia: Fix IFF_ALLMULTI flag functionality
Nir Dotan <nird(a)mellanox.com>
mlxsw: core_acl_flex_actions: Return error for conflicting actions
Jason Wang <jasowang(a)redhat.com>
vhost: reset metadata cache when initializing new IOTLB
Hangbin Liu <liuhangbin(a)gmail.com>
net_sched: Fix missing res info when create new tc_index filter
Cong Wang <xiyou.wangcong(a)gmail.com>
vsock: split dwork to avoid reinitializations
Hangbin Liu <liuhangbin(a)gmail.com>
net_sched: fix NULL pointer dereference when delete tcindex filter
Cong Wang <xiyou.wangcong(a)gmail.com>
llc: use refcount_inc_not_zero() for llc_sap_find()
Wei Wang <weiwan(a)google.com>
l2tp: use sk_dst_check() to avoid race on sk->sk_dst_cache
Alexey Kodanev <alexey.kodanev(a)oracle.com>
dccp: fix undefined behavior with 'cwnd' shift in ccid2_cwnd_restart()
-------------
Diffstat:
Makefile | 4 +-
drivers/acpi/sleep.c | 8 ++
drivers/isdn/i4l/isdn_common.c | 8 +-
drivers/misc/sram.c | 9 +-
.../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 2 +-
drivers/net/ethernet/marvell/mvneta.c | 53 ++++---
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 8 +-
.../mellanox/mlxsw/core_acl_flex_actions.c | 51 ++++---
drivers/net/ethernet/realtek/r8169.c | 12 +-
drivers/tty/serial/8250/8250_dw.c | 3 +-
drivers/tty/serial/8250/8250_exar.c | 6 +-
drivers/tty/serial/8250/8250_port.c | 3 +-
drivers/usb/serial/option.c | 4 +
drivers/usb/serial/pl2303.c | 2 +
drivers/usb/serial/pl2303.h | 1 +
drivers/usb/serial/sierra.c | 4 +-
drivers/vhost/vhost.c | 9 +-
include/net/af_vsock.h | 4 +-
include/net/llc.h | 5 +
net/bluetooth/sco.c | 3 +-
net/core/sock_diag.c | 2 +
net/dccp/ccids/ccid2.c | 6 +-
net/ipv4/ip_vti.c | 3 +-
net/ipv6/ip6_tunnel.c | 8 +-
net/l2tp/l2tp_core.c | 2 +-
net/llc/llc_core.c | 4 +-
net/rxrpc/ar-internal.h | 8 +-
net/rxrpc/conn_event.c | 4 +-
net/rxrpc/net_ns.c | 6 +-
net/rxrpc/output.c | 12 +-
net/rxrpc/peer_event.c | 156 ++++++++++++---------
net/rxrpc/peer_object.c | 8 +-
net/rxrpc/rxkad.c | 4 +-
net/sched/cls_matchall.c | 2 +
net/sched/cls_tcindex.c | 8 +-
net/socket.c | 3 +-
net/vmw_vsock/af_vsock.c | 15 +-
net/vmw_vsock/vmci_transport.c | 3 +-
sound/core/memalloc.c | 8 +-
sound/core/seq/oss/seq_oss.c | 2 +-
sound/core/seq/seq_clientmgr.c | 2 +-
sound/core/seq/seq_virmidi.c | 10 ++
sound/pci/cs5535audio/cs5535audio.h | 6 +-
sound/pci/cs5535audio/cs5535audio_pcm.c | 4 +-
sound/pci/hda/hda_intel.c | 2 +-
sound/pci/hda/patch_conexant.c | 4 +-
sound/pci/vx222/vx222_ops.c | 8 +-
sound/pcmcia/vx/vxp_ops.c | 10 +-
48 files changed, 296 insertions(+), 213 deletions(-)
Some versions of GCC suboptimally generate calls to the __multi3()
intrinsic for MIPS64r6 builds, resulting in link failures due to the
missing function:
LD vmlinux.o
MODPOST vmlinux.o
kernel/bpf/verifier.o: In function `kmalloc_array':
include/linux/slab.h:631: undefined reference to `__multi3'
fs/select.o: In function `kmalloc_array':
include/linux/slab.h:631: undefined reference to `__multi3'
...
We already have a workaround for this in which we provide the
instrinsic, but we do so selectively for GCC 7 only. Unfortunately the
issue occurs with older GCC versions too - it has been observed with
both GCC 5.4.0 & GCC 6.4.0.
MIPSr6 support was introduced in GCC 5, so all major GCC versions prior
to GCC 8 are affected and we extend our workaround accordingly to all
MIPS64r6 builds using GCC versions older than GCC 8.
Signed-off-by: Paul Burton <paul.burton(a)mips.com>
Reported-by: Vladimir Kondratiev <vladimir.kondratiev(a)intel.com>
Fixes: ebabcf17bcd7 ("MIPS: Implement __multi3 for GCC7 MIPS64r6 builds")
Cc: James Hogan <jhogan(a)kernel.org>
Cc: Ralf Baechle <ralf(a)linux-mips.org>
Cc: linux-mips(a)linux-mips.org
Cc: stable(a)vger.kernel.org # 4.15+
---
arch/mips/lib/multi3.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/mips/lib/multi3.c b/arch/mips/lib/multi3.c
index 111ad475aa0c..4c2483f410c2 100644
--- a/arch/mips/lib/multi3.c
+++ b/arch/mips/lib/multi3.c
@@ -4,12 +4,12 @@
#include "libgcc.h"
/*
- * GCC 7 suboptimally generates __multi3 calls for mips64r6, so for that
- * specific case only we'll implement it here.
+ * GCC 7 & older can suboptimally generate __multi3 calls for mips64r6, so for
+ * that specific case only we implement that intrinsic here.
*
* See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82981
*/
-#if defined(CONFIG_64BIT) && defined(CONFIG_CPU_MIPSR6) && (__GNUC__ == 7)
+#if defined(CONFIG_64BIT) && defined(CONFIG_CPU_MIPSR6) && (__GNUC__ < 8)
/* multiply 64-bit values, low 64-bits returned */
static inline long long notrace dmulu(long long a, long long b)
--
2.18.0
Just like how the P50 will occasionally leave the disp's core channel on
before nouveau starts initializing, it will occasionally do the same
thing with the rest of the dmac channel in addition to the core channel.
Example:
[ 1.604375] nouveau 0000:01:00.0: disp: outp 04:0006:0f81: no heads (0 3 4)
[ 1.604858] nouveau 0000:01:00.0: disp: outp 04:0006:0f81: aux power -> always
[ 1.605354] nouveau 0000:01:00.0: disp: outp 04:0006:0f81: aux power -> demand
[ 1.605815] nouveau 0000:01:00.0: disp: outp 05:0002:0f81: no heads (0 3 2)
[ 1.607289] nouveau 0000:01:00.0: disp: chid 0 mthd 0000 data 00000400 00001000 00000002
[ 1.608818] nouveau 0000:01:00.0: disp: chid 1 mthd 0000 data 00000400 00001000 00000002
[ 1.609500] nouveau 0000:01:00.0: disp: chid 2 mthd 0000 data 00000400 00001000 00000002
Which of course, later causes other parts of the card to start timing
out and failing. Closer inspection shows the same thing happening as
with our core channel; 0x610490 + (ctrl * 0x10) always has the same
unknown 0x000a0000 mask set when the phantom mthd failures start
appearing.
So, implement the same workaround we use for the core disp channel to
the rest of the disp channels.
This along with the previous patch fix random initialization failures
observed with the Thinkpad P50.
Signed-off-by: Lyude Paul <lyude(a)redhat.com>
Cc: Karol Herbst <karolherbst(a)gmail.com>
Cc: stable(a)vger.kernel.org
---
.../drm/nouveau/nvkm/engine/disp/dmacgf119.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/dmacgf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/dmacgf119.c
index edf7dd0d931d..7bc91f260e27 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/dmacgf119.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/dmacgf119.c
@@ -35,8 +35,8 @@ gf119_disp_dmac_bind(struct nv50_disp_chan *chan,
chan->chid.user << 27 | 0x00000001);
}
-void
-gf119_disp_dmac_fini(struct nv50_disp_chan *chan)
+static bool
+gf119_disp_dmac_deactivate(struct nv50_disp_chan *chan)
{
struct nvkm_subdev *subdev = &chan->disp->base.engine.subdev;
struct nvkm_device *device = subdev->device;
@@ -52,7 +52,16 @@ gf119_disp_dmac_fini(struct nv50_disp_chan *chan)
) < 0) {
nvkm_error(subdev, "ch %d fini: %08x\n", user,
nvkm_rd32(device, 0x610490 + (ctrl * 0x10)));
+ return false;
}
+
+ return true;
+}
+
+void
+gf119_disp_dmac_fini(struct nv50_disp_chan *chan)
+{
+ gf119_disp_dmac_deactivate(chan);
}
static int
@@ -63,6 +72,12 @@ gf119_disp_dmac_init(struct nv50_disp_chan *chan)
int ctrl = chan->chid.ctrl;
int user = chan->chid.user;
+ /* shut down the channel if it was left on, probably by the VBIOS */
+ if ((nvkm_rd32(device, 0x610490 + (ctrl * 0x10)) & 0x000a0000) == 0x000a0000 &&
+ WARN_ON(!gf119_disp_dmac_deactivate(chan))) {
+ return -EBUSY;
+ }
+
/* initialise channel for dma command submission */
nvkm_wr32(device, 0x610494 + (ctrl * 0x0010), chan->push);
nvkm_wr32(device, 0x610498 + (ctrl * 0x0010), 0x00010000);
--
2.17.1
bad_mode() handler is called for invalid or undefined
instruction in el1 level or when irq,fiq,sync or error
situation happen in el1 or el0 level.
As per latest code, above abnormal situation may not result in
panic always due to die() call if user mode is determined at
that moment. That will just result in kill of current process
and panic will be avoided which it must not.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=200637
Signed-off-by: Hari Vyas <hari.vyas(a)broadcom.com>
---
arch/arm64/kernel/traps.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index d399d45..716ee73 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -621,7 +621,6 @@ asmlinkage void bad_mode(struct pt_regs *regs, int reason, unsigned int esr)
handler[reason], smp_processor_id(), esr,
esr_get_class_string(esr));
- die("Oops - bad mode", regs, 0);
local_daif_mask();
panic("bad mode");
}
--
1.9.1
As reported by Dan Carpenter, a malicious USB device could set
port_number to -3 and we would underflow the port array in the interrupt
completion handler.
As these devices only have one or two ports, fix this by making sure we
only consider the seventh bit when determining the port number (and
ignore bits 0xb0 which are typically set to 0x30).
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable <stable(a)vger.kernel.org>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
Signed-off-by: Johan Hovold <johan(a)kernel.org>
---
drivers/usb/serial/io_ti.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/serial/io_ti.h b/drivers/usb/serial/io_ti.h
index e53c68261017..9bbcee37524e 100644
--- a/drivers/usb/serial/io_ti.h
+++ b/drivers/usb/serial/io_ti.h
@@ -173,7 +173,7 @@ struct ump_interrupt {
} __attribute__((packed));
-#define TIUMP_GET_PORT_FROM_CODE(c) (((c) >> 4) - 3)
+#define TIUMP_GET_PORT_FROM_CODE(c) (((c) >> 6) & 0x01)
#define TIUMP_GET_FUNC_FROM_CODE(c) ((c) & 0x0f)
#define TIUMP_INTERRUPT_CODE_LSR 0x03
#define TIUMP_INTERRUPT_CODE_MSR 0x04
--
2.18.0
We need that to adjust the len of the 2nd transfer (called data in spi-mem)
if it's too long to fit in a SPI message or SPI transfer.
Fixes: c36ff266dc82 ("spi: Extend the core to ease integration of SPI memory controllers")
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Boris Brezillon <boris.brezillon(a)bootlin.com>
Signed-off-by: Chuanhua Han <chuanhua.han(a)nxp.com>
---
Changes in v4:
-Rename variable name "opcode_addr_dummy_sum" to "len".
-The comparison of "spi_max_message_size(mem->spi)" and "len" was removed.
-Adjust their order when comparing the sizes of "spi_max_message_size(mem->spi)" and "len".
-Changing the "unsigned long" type in the code to "size_t".
Changes in v3:
-Rename variable name "val" to "opcode_addr_dummy_sum".
-Place the legitimacy of the transfer size(i.e., "spi_max_message_size(mem->spi)" and
-"opcode_addr_dummy_sum") into "if (! ctlr - > mem_ops | |! ctlr-> mem_ops->exec_op) {"
structure and add "spi_max_transfer_size(mem->spi) and opcode_addr_dummy_sum".
-Adjust the formatting alignment of the code.
-"(unsigned long)op->data.nbytes" was modified to "(unsigned long)(op->data.nbytes)".
Changes in v2:
-Place the adjusted transfer bytes code in spi_mem_adjust_op_size() and check
spi_max_message_size(mem->spi) value before subtracting opcode, addr and dummy bytes.
-Change the code from fsl-espi controller to generic code(The adjustment of spi transmission
length was originally modified in the "drivers/spi/spi-fsl-espi.c" file, and now the adjustment
of transfer length is made in the "drivers/spi/spi-mem.c" file).
drivers/spi/spi-mem.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
index 990770d..5374606 100644
--- a/drivers/spi/spi-mem.c
+++ b/drivers/spi/spi-mem.c
@@ -328,10 +328,23 @@ EXPORT_SYMBOL_GPL(spi_mem_exec_op);
int spi_mem_adjust_op_size(struct spi_mem *mem, struct spi_mem_op *op)
{
struct spi_controller *ctlr = mem->spi->controller;
+ size_t len = sizeof(op->cmd.opcode) +
+ op->addr.nbytes +
+ op->dummy.nbytes;
if (ctlr->mem_ops && ctlr->mem_ops->adjust_op_size)
return ctlr->mem_ops->adjust_op_size(mem, op);
+ if (!ctlr->mem_ops || !ctlr->mem_ops->exec_op) {
+ if (len > spi_max_transfer_size(mem->spi))
+ return -EINVAL;
+
+ op->data.nbytes = min3((size_t)(op->data.nbytes),
+ spi_max_transfer_size(mem->spi),
+ spi_max_message_size(mem->spi) -
+ len);
+ }
+
return 0;
}
EXPORT_SYMBOL_GPL(spi_mem_adjust_op_size);
--
2.7.4
We need that to adjust the len of the 2nd transfer (called data in spi-mem)
if it's too long to fit in a SPI message or SPI transfer.
Fixes: c36ff266dc82 ("spi: Extend the core to ease integration of SPI memory controllers")
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Boris Brezillon <boris.brezillon(a)bootlin.com>
Signed-off-by: Chuanhua Han <chuanhua.han(a)nxp.com>
---
Changes in v4:
-Rename variable name "opcode_addr_dummy_sum" to "len".
-The comparison of "spi_max_message_size(mem->spi)" and "len" was removed.
-Adjust their order when comparing the sizes of "spi_max_message_size(mem->spi)" and "len".
-Changing the "unsigned long" type in the code to "size_t".
Changes in v3:
-Rename variable name "val" to "opcode_addr_dummy_sum".
-Place the legitimacy of the transfer size(i.e., "spi_max_message_size(mem->spi)" and
-"opcode_addr_dummy_sum") into "if (! ctlr - > mem_ops | |! ctlr-> mem_ops->exec_op) {"
structure and add "spi_max_transfer_size(mem->spi) and opcode_addr_dummy_sum".
-Adjust the formatting alignment of the code.
-"(unsigned long)op->data.nbytes" was modified to "(unsigned long)(op->data.nbytes)".
Changes in v2:
-Place the adjusted transfer bytes code in spi_mem_adjust_op_size() and check
spi_max_message_size(mem->spi) value before subtracting opcode, addr and dummy bytes.
-Change the code from fsl-espi controller to generic code(The adjustment of spi transmission
length was originally modified in the "drivers/spi/spi-fsl-espi.c" file, and now the adjustment
of transfer length is made in the "drivers/spi/spi-mem.c" file).
drivers/spi/spi-mem.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
index 990770d..5374606 100644
--- a/drivers/spi/spi-mem.c
+++ b/drivers/spi/spi-mem.c
@@ -328,10 +328,23 @@ EXPORT_SYMBOL_GPL(spi_mem_exec_op);
int spi_mem_adjust_op_size(struct spi_mem *mem, struct spi_mem_op *op)
{
struct spi_controller *ctlr = mem->spi->controller;
+ size_t len = sizeof(op->cmd.opcode) +
+ op->addr.nbytes +
+ op->dummy.nbytes;
if (ctlr->mem_ops && ctlr->mem_ops->adjust_op_size)
return ctlr->mem_ops->adjust_op_size(mem, op);
+ if (!ctlr->mem_ops || !ctlr->mem_ops->exec_op) {
+ if (len > spi_max_transfer_size(mem->spi))
+ return -EINVAL;
+
+ op->data.nbytes = min3((size_t)(op->data.nbytes),
+ spi_max_transfer_size(mem->spi),
+ spi_max_message_size(mem->spi) -
+ len);
+ }
+
return 0;
}
EXPORT_SYMBOL_GPL(spi_mem_adjust_op_size);
--
2.7.4