From: alexander.levin@verizon.com
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Cc: Heinz Mauelshagen <heinzm@redhat.com>,
Mike Snitzer <snitzer@redhat.com>,
alexander.levin@verizon.com
Subject: [PATCH AUTOSEL for 4.14 62/64] dm raid: fix panic when attempting to force a raid to sync
Date: Sat, 2 Dec 2017 15:51:42 +0000 [thread overview]
Message-ID: <20171202155101.7573-62-alexander.levin@verizon.com> (raw)
In-Reply-To: <20171202155101.7573-1-alexander.levin@verizon.com>
From: Heinz Mauelshagen <heinzm@redhat.com>
[ Upstream commit 233978449074ca7e45d9c959f9ec612d1b852893 ]
Requesting a sync on an active raid device via a table reload
(see 'sync' parameter in Documentation/device-mapper/dm-raid.txt)
skips the super_load() call that defines the superblock size
(rdev->sb_size) -- resulting in an oops if/when super_sync()->memset()
is called.
Fix by moving the initialization of the superblock start and size
out of super_load() to the caller (analyse_superblocks).
Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
drivers/md/dm-raid.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 2245d06d2045..a25eebd98996 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -2143,13 +2143,6 @@ static int super_load(struct md_rdev *rdev, struct md_rdev *refdev)
struct dm_raid_superblock *refsb;
uint64_t events_sb, events_refsb;
- rdev->sb_start = 0;
- rdev->sb_size = bdev_logical_block_size(rdev->meta_bdev);
- if (rdev->sb_size < sizeof(*sb) || rdev->sb_size > PAGE_SIZE) {
- DMERR("superblock size of a logical block is no longer valid");
- return -EINVAL;
- }
-
r = read_disk_sb(rdev, rdev->sb_size, false);
if (r)
return r;
@@ -2494,6 +2487,17 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs)
if (test_bit(Journal, &rdev->flags))
continue;
+ if (!rdev->meta_bdev)
+ continue;
+
+ /* Set superblock offset/size for metadata device. */
+ rdev->sb_start = 0;
+ rdev->sb_size = bdev_logical_block_size(rdev->meta_bdev);
+ if (rdev->sb_size < sizeof(struct dm_raid_superblock) || rdev->sb_size > PAGE_SIZE) {
+ DMERR("superblock size of a logical block is no longer valid");
+ return -EINVAL;
+ }
+
/*
* Skipping super_load due to CTR_FLAG_SYNC will cause
* the array to undergo initialization again as
@@ -2506,9 +2510,6 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs)
if (test_bit(__CTR_FLAG_SYNC, &rs->ctr_flags))
continue;
- if (!rdev->meta_bdev)
- continue;
-
r = super_load(rdev, freshest);
switch (r) {
--
2.11.0
next prev parent reply other threads:[~2017-12-02 16:12 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-02 15:51 [PATCH AUTOSEL for 4.14 01/64] irqchip/qcom: Fix u32 comparison with value less than zero alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 02/64] net: ipv6: Fixup device for anycast routes during copy alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 03/64] net/smc: use sk_rcvbuf as start for rmb creation alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 04/64] kbuild: pkg: use --transform option to prefix paths in tar alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 06/64] powerpc/perf: Fix pmu_count to count only nest imc pmus alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 08/64] apparmor: fix leak of null profile name if profile allocation fails alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 07/64] net: qmi_wwan: add Quectel BG96 2c7c:0296 alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 05/64] coccinelle: fix parallel build with CHECK=scripts/coccicheck alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 10/64] mac80211_hwsim: Fix memory leak in hwsim_new_radio_nl() alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 09/64] x86/mpx/selftests: Fix up weird arrays alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 11/64] tun: fix rcu_read_lock imbalance in tun_build_skb alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 13/64] tcp: when scheduling TLP, time of RTO should account for current ACK alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 12/64] gre6: use log_ecn_error module parameter in ip6_tnl_rcv() alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 14/64] route: also update fnhe_genid when updating a route cache alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 15/64] route: update fnhe_expires for redirect when the fnhe exists alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 16/64] rsi: fix memory leak on buf and usb_reg_buf alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 17/64] drivers/rapidio/devices/rio_mport_cdev.c: fix resource leak in error handling path in 'rio_dma_transfer()' alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 18/64] pipe: match pipe_max_size data type with procfs alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 20/64] dynamic-debug-howto: fix optional/omitted ending line number to be LARGE instead of 0 alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 19/64] lib/genalloc.c: make the avail variable an atomic_long_t alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 21/64] NFS: Fix a typo in nfs_rename() alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 22/64] sunrpc: Fix rpc_task_begin trace point alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 25/64] xfs: fix forgotten rcu read unlock when skipping inode reclaim alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 23/64] nfp: inherit the max_mtu from the PF netdev alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 24/64] nfp: fix flower offload metadata flag usage alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 26/64] dt-bindings: usb: fix reg-property port-number range alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 28/64] sparc64/mm: set fields in deferred pages alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 27/64] block: wake up all tasks blocked in get_request() alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 30/64] slub: fix sysfs duplicate filename creation when slub_debug=O alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 31/64] sctp: do not free asoc when it is already dead in sctp_sendmsg alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 29/64] zsmalloc: calling zs_map_object() from irq is a bug alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 32/64] sctp: use the right sk after waking up from wait_buf sleep alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 33/64] fcntl: don't leak fd reference when fixup_compat_flock fails alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 34/64] geneve: fix fill_info when link down alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 35/64] bpf: fix lockdep splat alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 37/64] clk: stm32h7: fix test of clock config alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 36/64] ipv6: set all.accept_dad to 0 by default alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 38/64] clk: sunxi-ng: a83t: Fix i2c buses bits alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 40/64] clk: uniphier: fix DAPLL2 clock rate of Pro5 alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 39/64] clk: qcom: common: fix legacy board-clock registration alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 42/64] mailbox: mailbox-test: don't rely on rx_buffer content to signal data ready alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 41/64] clk: hi3660: fix incorrect uart3 clock freqency alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 45/64] jump_label: Invoke jump_label_test() via early_initcall() alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 44/64] atm: horizon: Fix irq release error alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 43/64] kbuild: rpm-pkg: fix jobserver unavailable warning alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 46/64] tls: Use kzalloc for aead_request allocation alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 47/64] xfrm: Copy policy family in clone_policy alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 49/64] bnxt_re: changing the ip address shouldn't affect new connections alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 50/64] IB/mlx4: Increase maximal message size under UD QP alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 48/64] f2fs: fix to clear FI_NO_PREALLOC alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 52/64] afs: Fix total-length calculation for multiple-page send alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 51/64] IB/mlx5: Assign send CQ and recv CQ of UMR QP alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 53/64] afs: Connect up the CB.ProbeUuid alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 54/64] kbuild: do not call cc-option before KBUILD_CFLAGS initialization alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 55/64] powerpc/powernv/idle: Round up latency and residency values alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 57/64] ide: ide-atapi: fix compile error with defining macro DEBUG alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 56/64] ipvlan: fix ipv6 outbound device alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 59/64] nvmet-rdma: update queue list during ib_device removal alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 58/64] blk-mq: Avoid that request queue removal can trigger list corruption alexander.levin
2017-12-02 15:51 ` alexander.levin [this message]
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 60/64] audit: Allow auditd to set pid to 0 to end auditing alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 61/64] audit: ensure that 'audit=1' actually enables audit for PID 1 alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 63/64] md: free unused memory after bitmap resize alexander.levin
2017-12-02 15:51 ` [PATCH AUTOSEL for 4.14 64/64] RDMA/cxgb4: Annotate r2 and stag as __be32 alexander.levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171202155101.7573-62-alexander.levin@verizon.com \
--to=alexander.levin@verizon.com \
--cc=heinzm@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=snitzer@redhat.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®