diff options
author | Eric Wheeler <git@linux.ewheeler.net> | 2016-02-26 14:33:56 -0800 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2016-03-08 09:19:08 -0700 |
commit | 9b299728ed777428b3908ac72ace5f8f84b97789 (patch) | |
tree | 5320279c9809787d11a8c735b4173b2c19374292 /lib/locking-selftest-rlock-softirq.h | |
parent | 07cc6ef8edc47f8b4fc1e276d31127a0a5863d4d (diff) | |
download | talos-obmc-linux-9b299728ed777428b3908ac72ace5f8f84b97789.tar.gz talos-obmc-linux-9b299728ed777428b3908ac72ace5f8f84b97789.zip |
bcache: cleaned up error handling around register_cache()
Fix null pointer dereference by changing register_cache() to return an int
instead of being void. This allows it to return -ENOMEM or -ENODEV and
enables upper layers to handle the OOM case without NULL pointer issues.
See this thread:
http://thread.gmane.org/gmane.linux.kernel.bcache.devel/3521
Fixes this error:
gargamel:/sys/block/md5/bcache# echo /dev/sdh2 > /sys/fs/bcache/register
bcache: register_cache() error opening sdh2: cannot allocate memory
BUG: unable to handle kernel NULL pointer dereference at 00000000000009b8
IP: [<ffffffffc05a7e8d>] cache_set_flush+0x102/0x15c [bcache]
PGD 120dff067 PUD 1119a3067 PMD 0
Oops: 0000 [#1] SMP
Modules linked in: veth ip6table_filter ip6_tables
(...)
CPU: 4 PID: 3371 Comm: kworker/4:3 Not tainted 4.4.2-amd64-i915-volpreempt-20160213bc1 #3
Hardware name: System manufacturer System Product Name/P8H67-M PRO, BIOS 3904 04/27/2013
Workqueue: events cache_set_flush [bcache]
task: ffff88020d5dc280 ti: ffff88020b6f8000 task.ti: ffff88020b6f8000
RIP: 0010:[<ffffffffc05a7e8d>] [<ffffffffc05a7e8d>] cache_set_flush+0x102/0x15c [bcache]
Signed-off-by: Eric Wheeler <bcache@linux.ewheeler.net>
Tested-by: Marc MERLIN <marc@merlins.org>
Cc: <stable@vger.kernel.org>
Diffstat (limited to 'lib/locking-selftest-rlock-softirq.h')
0 files changed, 0 insertions, 0 deletions