The patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From 08fc98a4d6424af66eb3ac4e2cedd2fc927ed436 Mon Sep 17 00:00:00 2001
From: Sahitya Tummala <stummala(a)codeaurora.org>
Date: Fri, 10 May 2019 22:00:33 -0400
Subject: [PATCH] ext4: fix use-after-free in dx_release()
The buffer_head (frames[0].bh) and it's corresping page can be
potentially free'd once brelse() is done inside the for loop
but before the for loop exits in dx_release(). It can be free'd
in another context, when the page cache is flushed via
drop_caches_sysctl_handler(). This results into below data abort
when accessing info->indirect_levels in dx_release().
Unable to handle kernel paging request at virtual address ffffffc17ac3e01e
Call trace:
dx_release+0x70/0x90
ext4_htree_fill_tree+0x2d4/0x300
ext4_readdir+0x244/0x6f8
iterate_dir+0xbc/0x160
SyS_getdents64+0x94/0x174
Signed-off-by: Sahitya Tummala <stummala(a)codeaurora.org>
Signed-off-by: Theodore Ts'o <tytso(a)mit.edu>
Reviewed-by: Andreas Dilger <adilger(a)dilger.ca>
Cc: stable(a)kernel.org
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index e917830eae84..ac7457fef9e6 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -872,12 +872,15 @@ static void dx_release(struct dx_frame *frames)
{
struct dx_root_info *info;
int i;
+ unsigned int indirect_levels;
if (frames[0].bh == NULL)
return;
info = &((struct dx_root *)frames[0].bh->b_data)->info;
- for (i = 0; i <= info->indirect_levels; i++) {
+ /* save local copy, "info" may be freed after brelse() */
+ indirect_levels = info->indirect_levels;
+ for (i = 0; i <= indirect_levels; i++) {
if (frames[i].bh == NULL)
break;
brelse(frames[i].bh);
The patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From 08fc98a4d6424af66eb3ac4e2cedd2fc927ed436 Mon Sep 17 00:00:00 2001
From: Sahitya Tummala <stummala(a)codeaurora.org>
Date: Fri, 10 May 2019 22:00:33 -0400
Subject: [PATCH] ext4: fix use-after-free in dx_release()
The buffer_head (frames[0].bh) and it's corresping page can be
potentially free'd once brelse() is done inside the for loop
but before the for loop exits in dx_release(). It can be free'd
in another context, when the page cache is flushed via
drop_caches_sysctl_handler(). This results into below data abort
when accessing info->indirect_levels in dx_release().
Unable to handle kernel paging request at virtual address ffffffc17ac3e01e
Call trace:
dx_release+0x70/0x90
ext4_htree_fill_tree+0x2d4/0x300
ext4_readdir+0x244/0x6f8
iterate_dir+0xbc/0x160
SyS_getdents64+0x94/0x174
Signed-off-by: Sahitya Tummala <stummala(a)codeaurora.org>
Signed-off-by: Theodore Ts'o <tytso(a)mit.edu>
Reviewed-by: Andreas Dilger <adilger(a)dilger.ca>
Cc: stable(a)kernel.org
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index e917830eae84..ac7457fef9e6 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -872,12 +872,15 @@ static void dx_release(struct dx_frame *frames)
{
struct dx_root_info *info;
int i;
+ unsigned int indirect_levels;
if (frames[0].bh == NULL)
return;
info = &((struct dx_root *)frames[0].bh->b_data)->info;
- for (i = 0; i <= info->indirect_levels; i++) {
+ /* save local copy, "info" may be freed after brelse() */
+ indirect_levels = info->indirect_levels;
+ for (i = 0; i <= indirect_levels; i++) {
if (frames[i].bh == NULL)
break;
brelse(frames[i].bh);
The patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From 57a0da28ced8707cb9f79f071a016b9d005caf5a Mon Sep 17 00:00:00 2001
From: Lukas Czerner <lczerner(a)redhat.com>
Date: Fri, 10 May 2019 21:45:33 -0400
Subject: [PATCH] ext4: fix data corruption caused by overlapping unaligned and
aligned IO
Unaligned AIO must be serialized because the zeroing of partial blocks
of unaligned AIO can result in data corruption in case it's overlapping
another in flight IO.
Currently we wait for all unwritten extents before we submit unaligned
AIO which protects data in case of unaligned AIO is following overlapping
IO. However if a unaligned AIO is followed by overlapping aligned AIO we
can still end up corrupting data.
To fix this, we must make sure that the unaligned AIO is the only IO in
flight by waiting for unwritten extents conversion not just before the
IO submission, but right after it as well.
This problem can be reproduced by xfstest generic/538
Signed-off-by: Lukas Czerner <lczerner(a)redhat.com>
Signed-off-by: Theodore Ts'o <tytso(a)mit.edu>
Cc: stable(a)kernel.org
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 98ec11f69cd4..2c5baa5e8291 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -264,6 +264,13 @@ ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
}
ret = __generic_file_write_iter(iocb, from);
+ /*
+ * Unaligned direct AIO must be the only IO in flight. Otherwise
+ * overlapping aligned IO after unaligned might result in data
+ * corruption.
+ */
+ if (ret == -EIOCBQUEUED && unaligned_aio)
+ ext4_unwritten_wait(inode);
inode_unlock(inode);
if (ret > 0)
On 2019/4/30 下午6:32, Sasha Levin wrote:
> Hi,
>
> [This is an automated email]
>
> This commit has been processed because it contains a -stable tag.
> The stable tag indicates that it's relevant for the following trees: all.
>
> The bot has tested the following trees: v5.0.10, v4.19.37, v4.14.114, v4.9.171, v4.4.179, v3.18.139.
>
> v5.0.10: Build OK!
> v4.19.37: Build OK!
> v4.14.114: Build OK!
> v4.9.171: Failed to apply! Possible dependencies:
> 113c60970cf4 ("x86/intel_rdt: Add Haswell feature discovery")
> 2264d9c74dda ("x86/intel_rdt: Build structures for each resource based on cache topology")
> 3ee7e8697d58 ("bdi: Fix another oops in wb_workfn()")
> 4f341a5e4844 ("x86/intel_rdt: Add scheduler hook")
> 5318ce7d4686 ("bdi: Shutdown writeback on all cgwbs in cgwb_bdi_destroy()")
> 5b825c3af1d8 ("sched/headers: Prepare to remove <linux/cred.h> inclusion from <linux/sched.h>")
> 5dd43ce2f69d ("sched/wait: Split out the wait_bit*() APIs from <linux/wait.h> into <linux/wait_bit.h>")
> 5ff193fbde20 ("x86/intel_rdt: Add basic resctrl filesystem support")
> 60cf5e101fd4 ("x86/intel_rdt: Add mkdir to resctrl file system")
> 60ec2440c63d ("x86/intel_rdt: Add schemata file")
> 6b2bb7265f0b ("sched/wait: Introduce wait_var_event()")
> 78e99b4a2b9a ("x86/intel_rdt: Add CONFIG, Makefile, and basic initialization")
> 7fc5854f8c6e ("writeback: synchronize sync(2) against cgroup writeback membership switches")
> 8236b0ae31c8 ("bdi: wake up concurrent wb_shutdown() callers.")
> c1c7c3f9d6bb ("x86/intel_rdt: Pick up L3/L2 RDT parameters from CPUID")
>
> v4.4.179: Failed to apply! Possible dependencies:
> 0007bccc3cfd ("x86: Replace RDRAND forced-reseed with simple sanity check")
> 113c60970cf4 ("x86/intel_rdt: Add Haswell feature discovery")
> 1b74dde7c47c ("x86/cpu: Convert printk(KERN_<LEVEL> ...) to pr_<level>(...)")
> 27f6d22b037b ("perf/x86: Move perf_event.h to its new home")
> 39b0332a2158 ("perf/x86: Move perf_event_amd.c ........... => x86/events/amd/core.c")
> 3ee7e8697d58 ("bdi: Fix another oops in wb_workfn()")
> 4f341a5e4844 ("x86/intel_rdt: Add scheduler hook")
> 5318ce7d4686 ("bdi: Shutdown writeback on all cgwbs in cgwb_bdi_destroy()")
> 5b825c3af1d8 ("sched/headers: Prepare to remove <linux/cred.h> inclusion from <linux/sched.h>")
> 5dd43ce2f69d ("sched/wait: Split out the wait_bit*() APIs from <linux/wait.h> into <linux/wait_bit.h>")
> 6b2bb7265f0b ("sched/wait: Introduce wait_var_event()")
> 724697648eec ("perf/x86: Use INST_RETIRED.PREC_DIST for cycles: ppp")
> 7fc5854f8c6e ("writeback: synchronize sync(2) against cgroup writeback membership switches")
> 8236b0ae31c8 ("bdi: wake up concurrent wb_shutdown() callers.")
> fa9cbf320e99 ("perf/x86: Move perf_event.c ............... => x86/events/core.c")
>
> v3.18.139: Failed to apply! Possible dependencies:
> 0ae45f63d4ef ("vfs: add support for a lazytime mount option")
> 4452226ea276 ("writeback: move backing_dev_info->state into bdi_writeback")
> 52ebea749aae ("writeback: make backing_dev_info host cgroup-specific bdi_writebacks")
> 66114cad64bf ("writeback: separate out include/linux/backing-dev-defs.h")
> 682aa8e1a6a1 ("writeback: implement unlocked_inode_to_wb transaction and use it for stat updates")
> 87e1d789bf55 ("writeback: implement [locked_]inode_to_wb_and_lock_list()")
> a3816ab0e8fe ("fs: Convert show_fdinfo functions to void")
> b16b1deb553a ("writeback: make writeback_control track the inode being written back")
> b4caecd48005 ("fs: introduce f_op->mmap_capabilities for nommu mmap support")
> bafc0dba1e20 ("buffer, writeback: make __block_write_full_page() honor cgroup writeback")
>
>
> How should we proceed with this patch?
>
> --
I am sorry that I forgot to mention that the patch should be applied to stable
since v4.4.
v4.4.179 and v4.9.171 depend on the commit 7fc5854f8c6e ("writeback: synchronize sync(2) against cgroup writeback membership switches").
On these two versions we can just inc isw_nr_in_flight before return.
The patch is pasted below.
--- linux-4.4.179.orig/fs/fs-writeback.c.orig 2019-05-05 19:56:29.993961267 +0800
+++ linux-4.4.179/fs/fs-writeback.c 2019-05-05 19:39:55.880336751 +0800
@@ -502,8 +502,6 @@ static void inode_switch_wbs(struct inod
ihold(inode);
isw->inode = inode;
- atomic_inc(&isw_nr_in_flight);
-
/*
* In addition to synchronizing among switchers, I_WB_SWITCH tells
* the RCU protected stat update paths to grab the mapping's
@@ -511,6 +509,9 @@ static void inode_switch_wbs(struct inod
* Let's continue after I_WB_SWITCH is guaranteed to be visible.
*/
call_rcu(&isw->rcu_head, inode_switch_wbs_rcu_fn);
+
+ atomic_inc(&isw_nr_in_flight);
+
return;
out_free:
@@ -880,7 +881,11 @@ restart:
void cgroup_writeback_umount(void)
{
if (atomic_read(&isw_nr_in_flight)) {
- synchronize_rcu();
+ /*
+ * Use rcu_barrier() to wait for all pending callbacks to
+ * ensure that all in-flight wb switches are in the workqueue.
+ */
+ rcu_barrier();
flush_workqueue(isw_wq);
}
}
Thanks,
Jiufei
> Thanks,
> Sasha
>
This is the start of the stable review cycle for the 4.9.177 release.
There are 51 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 Fri 17 May 2019 09:04:42 AM UTC.
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.177-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.177-rc1
Laurentiu Tudor <laurentiu.tudor(a)nxp.com>
powerpc/booke64: set RI in default MSR
Christophe Leroy <christophe.leroy(a)c-s.fr>
powerpc/lib: fix book3s/32 boot failure due to code patching
Dan Carpenter <dan.carpenter(a)oracle.com>
drivers/virt/fsl_hypervisor.c: prevent integer overflow in ioctl
Dan Carpenter <dan.carpenter(a)oracle.com>
drivers/virt/fsl_hypervisor.c: dereferencing error pointers in ioctl
Jarod Wilson <jarod(a)redhat.com>
bonding: fix arp_validate toggling in active-backup mode
David Ahern <dsahern(a)gmail.com>
ipv4: Fix raw socket lookup for local traffic
Stephen Suryaputra <ssuryaextr(a)gmail.com>
vrf: sit mtu should not be updated when vrf netdev is the link
Hangbin Liu <liuhangbin(a)gmail.com>
vlan: disable SIOCSHWTSTAMP in container
YueHaibing <yuehaibing(a)huawei.com>
packet: Fix error path in packet_init
Christophe Leroy <christophe.leroy(a)c-s.fr>
net: ucc_geth - fix Oops when changing number of buffers in the ring
Hangbin Liu <liuhangbin(a)gmail.com>
fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied
Tobin C. Harding <tobin(a)kernel.org>
bridge: Fix error path for kobject_init_and_add()
Breno Leitao <leitao(a)debian.org>
powerpc/64s: Include cpu header
Alistair Strachan <astrachan(a)google.com>
x86/vdso: Pass --eh-frame-hdr to the linker
Nick Desaulniers <ndesaulniers(a)google.com>
x86/vdso: Drop implicit common-page-size linker flag
Alistair Strachan <astrachan(a)google.com>
x86: vdso: Use $LD instead of $CC to link
Sasha Levin <sashal(a)kernel.org>
Revert "x86: vdso: Use $LD instead of $CC to link"
Sasha Levin <sashal(a)kernel.org>
Revert "x86/vdso: Drop implicit common-page-size linker flag"
Nigel Croxon <ncroxon(a)redhat.com>
Don't jump to compute_result state from check_result state
Gustavo A. R. Silva <gustavo(a)embeddedor.com>
rtlwifi: rtl8723ae: Fix missing break in switch statement
Takashi Sakamoto <o-takashi(a)sakamocchi.jp>
ALSA: pcm: remove SNDRV_PCM_IOCTL1_INFO internal command
Wei Yongjun <weiyongjun1(a)huawei.com>
cw1200: fix missing unlock on error in cw1200_hw_scan()
Pan Bian <bianpan2016(a)163.com>
Input: synaptics-rmi4 - fix possible double free
Daniel Gomez <dagmcr(a)gmail.com>
spi: ST ST95HF NFC: declare missing of table
Daniel Gomez <dagmcr(a)gmail.com>
spi: Micrel eth switch: declare missing of table
Lucas Stach <l.stach(a)pengutronix.de>
gpu: ipu-v3: dp: fix CSC handling
Po-Hsu Lin <po-hsu.lin(a)canonical.com>
selftests/net: correct the return value for run_netsocktests
Paul Kocialkowski <paul.kocialkowski(a)bootlin.com>
drm/sun4i: Set device driver data at bind time for use in unbind
Arnd Bergmann <arnd(a)arndb.de>
s390: ctcm: fix ctcm_new_device error return code
Petr Štetiar <ynezz(a)true.cz>
MIPS: perf: ath79: Fix perfcount IRQ assignment
Julian Anastasov <ja(a)ssi.bg>
ipvs: do not schedule icmp errors from tunnels
Florian Westphal <fw(a)strlen.de>
selftests: netfilter: check icmp pkttoobig errors are set as related
Dan Williams <dan.j.williams(a)intel.com>
init: initialize jump labels before command line option parsing
Rikard Falkeborn <rikard.falkeborn(a)gmail.com>
tools lib traceevent: Fix missing equality check for strcmp
Vitaly Kuznetsov <vkuznets(a)redhat.com>
KVM: x86: avoid misreporting level-triggered irqs as edge-triggered in tracing
Jian-Hong Pan <jian-hong(a)endlessm.com>
x86/reboot, efi: Use EFI reboot for Acer TravelMate X514-51T
Tetsuo Handa <penguin-kernel(a)I-love.SAKURA.ne.jp>
mISDN: Check address length before reading address family
Martin Schwidefsky <schwidefsky(a)de.ibm.com>
s390/3270: fix lockdep false positive on view->lock
Felix Fietkau <nbd(a)nbd.name>
mac80211: fix unaligned access in mesh table hash function
Peter Oberparleiter <oberpar(a)linux.ibm.com>
s390/dasd: Fix capacity calculation for large volumes
Aditya Pakki <pakki001(a)umn.edu>
libnvdimm/btt: Fix a kmemdup failure check
Dmitry Torokhov <dmitry.torokhov(a)gmail.com>
HID: input: add mapping for "Toggle Display" key
Dmitry Torokhov <dmitry.torokhov(a)gmail.com>
HID: input: add mapping for keyboard Brightness Up/Down/Toggle keys
Dmitry Torokhov <dmitry.torokhov(a)gmail.com>
HID: input: add mapping for Expose/Overview key
Kangjie Lu <kjlu(a)umn.edu>
libnvdimm/namespace: Fix a potential NULL pointer dereference
Sven Van Asbroeck <thesven73(a)gmail.com>
iio: adc: xilinx: fix potential use-after-free on remove
Johan Hovold <johan(a)kernel.org>
USB: serial: fix unthrottle races
Gustavo A. R. Silva <gustavo(a)embeddedor.com>
platform/x86: sony-laptop: Fix unintentional fall-through
Alexei Starovoitov <ast(a)fb.com>
bpf: convert htab map to hlist_nulls
Alexei Starovoitov <ast(a)fb.com>
bpf: fix struct htab_elem layout
Francesco Ruggeri <fruggeri(a)arista.com>
netfilter: compat: initialize all fields in xt_init
-------------
Diffstat:
Makefile | 4 +-
arch/mips/ath79/setup.c | 6 -
arch/powerpc/include/asm/reg_booke.h | 2 +-
arch/powerpc/kernel/security.c | 1 +
arch/powerpc/lib/code-patching.c | 2 +-
arch/x86/entry/vdso/Makefile | 3 +-
arch/x86/kernel/reboot.c | 21 ++
arch/x86/kvm/trace.h | 4 +-
drivers/gpu/drm/sun4i/sun4i_drv.c | 2 +
drivers/gpu/ipu-v3/ipu-dp.c | 12 +-
drivers/hid/hid-input.c | 14 +
drivers/iio/adc/xilinx-xadc-core.c | 2 +-
drivers/input/rmi4/rmi_driver.c | 6 +-
drivers/irqchip/irq-ath79-misc.c | 11 +
drivers/isdn/mISDN/socket.c | 4 +-
drivers/md/raid5.c | 19 +-
drivers/net/bonding/bond_options.c | 7 -
drivers/net/ethernet/freescale/ucc_geth_ethtool.c | 8 +-
drivers/net/phy/spi_ks8995.c | 9 +
.../net/wireless/realtek/rtlwifi/rtl8723ae/hw.c | 1 +
drivers/net/wireless/st/cw1200/scan.c | 5 +-
drivers/nfc/st95hf/core.c | 7 +
drivers/nvdimm/btt_devs.c | 18 +-
drivers/nvdimm/namespace_devs.c | 5 +-
drivers/platform/x86/sony-laptop.c | 8 +-
drivers/s390/block/dasd_eckd.c | 6 +-
drivers/s390/char/con3270.c | 2 +-
drivers/s390/char/fs3270.c | 3 +-
drivers/s390/char/raw3270.c | 3 +-
drivers/s390/char/raw3270.h | 4 +-
drivers/s390/char/tty3270.c | 3 +-
drivers/s390/net/ctcm_main.c | 1 +
drivers/usb/serial/generic.c | 39 ++-
drivers/virt/fsl_hypervisor.c | 29 ++-
include/linux/efi.h | 7 +-
include/linux/list_nulls.h | 5 +
include/linux/rculist_nulls.h | 14 +
include/sound/pcm.h | 2 +-
init/main.c | 4 +-
kernel/bpf/hashtab.c | 99 ++++---
net/8021q/vlan_dev.c | 4 +-
net/bridge/br_if.c | 13 +-
net/core/fib_rules.c | 6 +-
net/ipv4/raw.c | 4 +-
net/ipv6/sit.c | 2 +-
net/mac80211/mesh_pathtbl.c | 2 +-
net/netfilter/ipvs/ip_vs_core.c | 2 +-
net/netfilter/x_tables.c | 2 +-
net/packet/af_packet.c | 25 +-
sound/core/pcm_lib.c | 2 -
sound/core/pcm_native.c | 6 +-
tools/lib/traceevent/event-parse.c | 2 +-
tools/testing/selftests/net/run_netsocktests | 2 +-
tools/testing/selftests/netfilter/Makefile | 2 +-
.../selftests/netfilter/conntrack_icmp_related.sh | 283 +++++++++++++++++++++
55 files changed, 605 insertions(+), 154 deletions(-)
This is a note to let you know that I've just added the patch titled
staging: vc04_services: prevent integer overflow in create_pagelist()
to my staging git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
in the staging-linus branch.
The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the
next -rc kernel release.
If you have any questions about this process, please let me know.
>From ca641bae6da977d638458e78cd1487b6160a2718 Mon Sep 17 00:00:00 2001
From: Dan Carpenter <dan.carpenter(a)oracle.com>
Date: Wed, 15 May 2019 12:38:33 +0300
Subject: staging: vc04_services: prevent integer overflow in create_pagelist()
The create_pagelist() "count" parameter comes from the user in
vchiq_ioctl() and it could overflow. If you look at how create_page()
is called in vchiq_prepare_bulk_data(), then the "size" variable is an
int so it doesn't make sense to allow negatives or larger than INT_MAX.
I don't know this code terribly well, but I believe that typical values
of "count" are typically quite low and I don't think this check will
affect normal valid uses at all.
The "pagelist_size" calculation can also overflow on 32 bit systems, but
not on 64 bit systems. I have added an integer overflow check for that
as well.
The Raspberry PI doesn't offer the same level of memory protection that
x86 does so these sorts of bugs are probably not super critical to fix.
Fixes: 71bad7f08641 ("staging: add bcm2708 vchiq driver")
Signed-off-by: Dan Carpenter <dan.carpenter(a)oracle.com>
Cc: stable <stable(a)vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
.../vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index a9a22917ecdb..c557c9953724 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -368,9 +368,18 @@ create_pagelist(char __user *buf, size_t count, unsigned short type)
int dma_buffers;
dma_addr_t dma_addr;
+ if (count >= INT_MAX - PAGE_SIZE)
+ return NULL;
+
offset = ((unsigned int)(unsigned long)buf & (PAGE_SIZE - 1));
num_pages = DIV_ROUND_UP(count + offset, PAGE_SIZE);
+ if (num_pages > (SIZE_MAX - sizeof(struct pagelist) -
+ sizeof(struct vchiq_pagelist_info)) /
+ (sizeof(u32) + sizeof(pages[0]) +
+ sizeof(struct scatterlist)))
+ return NULL;
+
pagelist_size = sizeof(struct pagelist) +
(num_pages * sizeof(u32)) +
(num_pages * sizeof(pages[0]) +
--
2.21.0
This is a note to let you know that I've just added the patch titled
staging: wlan-ng: fix adapter initialization failure
to my staging git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
in the staging-linus branch.
The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the
next -rc kernel release.
If you have any questions about this process, please let me know.
>From a67fedd788182764dc8ed59037c604b7e60349f1 Mon Sep 17 00:00:00 2001
From: Tim Collier <osdevtc(a)gmail.com>
Date: Sat, 11 May 2019 18:40:46 +0100
Subject: staging: wlan-ng: fix adapter initialization failure
Commit e895f00a8496 ("Staging: wlan-ng: hfa384x_usb.c Fixed too long
code line warnings.") moved the retrieval of the transfer buffer from
the URB from the top of function hfa384x_usbin_callback to a point
after reposting of the URB via a call to submit_rx_urb. The reposting
of the URB allocates a new transfer buffer so the new buffer is
retrieved instead of the buffer containing the response passed into
the callback. This results in failure to initialize the adapter with
an error reported in the system log (something like "CTLX[1] error:
state(Request failed)").
This change moves the retrieval to just before the point where the URB
is reposted so that the correct transfer buffer is retrieved and
initialization of the device succeeds.
Signed-off-by: Tim Collier <osdevtc(a)gmail.com>
Fixes: e895f00a8496 ("Staging: wlan-ng: hfa384x_usb.c Fixed too long code line warnings.")
Cc: stable <stable(a)vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
drivers/staging/wlan-ng/hfa384x_usb.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index 6fde75d4f064..ab734534093b 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -3119,7 +3119,9 @@ static void hfa384x_usbin_callback(struct urb *urb)
break;
}
+ /* Save values from the RX URB before reposting overwrites it. */
urb_status = urb->status;
+ usbin = (union hfa384x_usbin *)urb->transfer_buffer;
if (action != ABORT) {
/* Repost the RX URB */
@@ -3136,7 +3138,6 @@ static void hfa384x_usbin_callback(struct urb *urb)
/* Note: the check of the sw_support field, the type field doesn't
* have bit 12 set like the docs suggest.
*/
- usbin = (union hfa384x_usbin *)urb->transfer_buffer;
type = le16_to_cpu(usbin->type);
if (HFA384x_USB_ISRXFRM(type)) {
if (action == HANDLE) {
--
2.21.0
This is a note to let you know that I've just added the patch titled
iio: dac: ds4422/ds4424 fix chip verification
to my staging git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
in the staging-linus branch.
The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the
next -rc kernel release.
If you have any questions about this process, please let me know.
>From 60f2208699ec08ff9fdf1f97639a661a92a18f1c Mon Sep 17 00:00:00 2001
From: Ruslan Babayev <ruslan(a)babayev.com>
Date: Sun, 5 May 2019 12:24:37 -0700
Subject: iio: dac: ds4422/ds4424 fix chip verification
The ds4424_get_value function takes channel number as it's 3rd
argument and translates it internally into I2C address using
DS4424_DAC_ADDR macro. The caller ds4424_verify_chip was passing an
already translated I2C address as its last argument.
Signed-off-by: Ruslan Babayev <ruslan(a)babayev.com>
Cc: xe-linux-external(a)cisco.com
Cc: <Stable(a)vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron(a)huawei.com>
---
drivers/iio/dac/ds4424.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/dac/ds4424.c b/drivers/iio/dac/ds4424.c
index 883a47562055..714a97f91319 100644
--- a/drivers/iio/dac/ds4424.c
+++ b/drivers/iio/dac/ds4424.c
@@ -166,7 +166,7 @@ static int ds4424_verify_chip(struct iio_dev *indio_dev)
{
int ret, val;
- ret = ds4424_get_value(indio_dev, &val, DS4424_DAC_ADDR(0));
+ ret = ds4424_get_value(indio_dev, &val, 0);
if (ret < 0)
dev_err(&indio_dev->dev,
"%s failed. ret: %d\n", __func__, ret);
--
2.21.0