No description
Find a file
Cengiz Can 6d1444dbf9 blktrace: fix dereference after null check
commit 153031a301 upstream.

There was a recent change in blktrace.c that added a RCU protection to
`q->blk_trace` in order to fix a use-after-free issue during access.

However the change missed an edge case that can lead to dereferencing of
`bt` pointer even when it's NULL:

Coverity static analyzer marked this as a FORWARD_NULL issue with CID
1460458.

```
/kernel/trace/blktrace.c: 1904 in sysfs_blk_trace_attr_store()
1898            ret = 0;
1899            if (bt == NULL)
1900                    ret = blk_trace_setup_queue(q, bdev);
1901
1902            if (ret == 0) {
1903                    if (attr == &dev_attr_act_mask)
>>>     CID 1460458:  Null pointer dereferences  (FORWARD_NULL)
>>>     Dereferencing null pointer "bt".
1904                            bt->act_mask = value;
1905                    else if (attr == &dev_attr_pid)
1906                            bt->pid = value;
1907                    else if (attr == &dev_attr_start_lba)
1908                            bt->start_lba = value;
1909                    else if (attr == &dev_attr_end_lba)
```

Added a reassignment with RCU annotation to fix the issue.

Fixes: c780e86dd4 ("blktrace: Protect q->blk_trace with RCU")
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Bob Liu <bob.liu@oracle.com>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Cengiz Can <cengiz@kernel.wtf>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-29 16:31:17 +02:00
arch Revert "powerpc/64: irq_work avoid interrupt when called with hardware irqs enabled" 2020-04-29 16:31:14 +02:00
block block, bfq: fix use-after-free in bfq_idle_slice_timer_body 2020-04-17 10:48:42 +02:00
certs
crypto
Documentation arm64: errata: Hide CTR_EL0.DIC on systems affected by Neoverse-N1 #1542419 2020-04-29 16:31:08 +02:00
drivers net: ipv6_stub: use ip6_dst_lookup_flow instead of ip6_dst_lookup 2020-04-29 16:31:17 +02:00
firmware
fs ceph: don't skip updating wanted caps when cap is stale 2020-04-29 16:31:11 +02:00
include blktrace: Protect q->blk_trace with RCU 2020-04-29 16:31:17 +02:00
init
ipc ipc/util.c: sysvipc_find_ipc() should increase position index 2020-04-29 16:31:13 +02:00
kernel blktrace: fix dereference after null check 2020-04-29 16:31:17 +02:00
lib lib/raid6: use vdupq_n_u8 to avoid endianness warnings 2020-04-23 10:30:15 +02:00
LICENSES
mm mm/vmalloc.c: move 'area->pages' after if statement 2020-04-21 09:03:13 +02:00
net net: ipv6_stub: use ip6_dst_lookup_flow instead of ip6_dst_lookup 2020-04-29 16:31:17 +02:00
samples
scripts kconfig: qconf: Fix a few alignment issues 2020-04-29 16:31:13 +02:00
security KEYS: Don't write out to userspace while holding key semaphore 2020-04-23 10:30:24 +02:00
sound ASoC: Intel: bytcr_rt5640: Add quirk for MPMAN MPWIN895CL tablet 2020-04-29 16:31:15 +02:00
tools tracing/selftests: Turn off timeout setting 2020-04-29 16:31:15 +02:00
usr initramfs: restore default compression behavior 2020-04-13 10:44:59 +02:00
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile Linux 4.19.118 2020-04-23 10:30:24 +02:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.
See Documentation/00-INDEX for a list of what is contained in each file.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.