diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-06 17:42:34 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-06 17:42:34 -0500 |
commit | 50dcb6cdb70281d76b28d1564f8e076bb08f2c60 (patch) | |
tree | c8884d0b8676fa7a9b44c1d678b48e40561aa994 | |
parent | 72df5eba704252e54b5b19395cb938f8bb55cab8 (diff) | |
parent | f5b0cba8f23915e92932f11eb063e37d70556a89 (diff) |
Merge tag 'dm-4.10-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
Pull device mapper fixes from Mike Snitzer:
- a fix for a race in .request_fn request-based DM request handling vs
DM device destruction
- an RCU fix for dm-crypt's kernel keyring support that was included in
4.10-rc1
- a -Wbool-operation warning fix for DM multipath
* tag 'dm-4.10-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
dm crypt: replace RCU read-side section with rwsem
dm rq: cope with DM device destruction while in dm_old_request_fn()
dm mpath: cleanup -Wbool-operation warning in choose_pgpath()
-rw-r--r-- | drivers/md/dm-crypt.c | 8 | ||||
-rw-r--r-- | drivers/md/dm-mpath.c | 4 | ||||
-rw-r--r-- | drivers/md/dm-rq.c | 4 |
3 files changed, 10 insertions, 6 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 7c6c57216bf2..8a9f742d8ed7 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -1534,18 +1534,18 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string | |||
1534 | return PTR_ERR(key); | 1534 | return PTR_ERR(key); |
1535 | } | 1535 | } |
1536 | 1536 | ||
1537 | rcu_read_lock(); | 1537 | down_read(&key->sem); |
1538 | 1538 | ||
1539 | ukp = user_key_payload(key); | 1539 | ukp = user_key_payload(key); |
1540 | if (!ukp) { | 1540 | if (!ukp) { |
1541 | rcu_read_unlock(); | 1541 | up_read(&key->sem); |
1542 | key_put(key); | 1542 | key_put(key); |
1543 | kzfree(new_key_string); | 1543 | kzfree(new_key_string); |
1544 | return -EKEYREVOKED; | 1544 | return -EKEYREVOKED; |
1545 | } | 1545 | } |
1546 | 1546 | ||
1547 | if (cc->key_size != ukp->datalen) { | 1547 | if (cc->key_size != ukp->datalen) { |
1548 | rcu_read_unlock(); | 1548 | up_read(&key->sem); |
1549 | key_put(key); | 1549 | key_put(key); |
1550 | kzfree(new_key_string); | 1550 | kzfree(new_key_string); |
1551 | return -EINVAL; | 1551 | return -EINVAL; |
@@ -1553,7 +1553,7 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string | |||
1553 | 1553 | ||
1554 | memcpy(cc->key, ukp->data, cc->key_size); | 1554 | memcpy(cc->key, ukp->data, cc->key_size); |
1555 | 1555 | ||
1556 | rcu_read_unlock(); | 1556 | up_read(&key->sem); |
1557 | key_put(key); | 1557 | key_put(key); |
1558 | 1558 | ||
1559 | /* clear the flag since following operations may invalidate previously valid key */ | 1559 | /* clear the flag since following operations may invalidate previously valid key */ |
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 6400cffb986d..3570bcb7a4a4 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -427,7 +427,7 @@ static struct pgpath *choose_pgpath(struct multipath *m, size_t nr_bytes) | |||
427 | unsigned long flags; | 427 | unsigned long flags; |
428 | struct priority_group *pg; | 428 | struct priority_group *pg; |
429 | struct pgpath *pgpath; | 429 | struct pgpath *pgpath; |
430 | bool bypassed = true; | 430 | unsigned bypassed = 1; |
431 | 431 | ||
432 | if (!atomic_read(&m->nr_valid_paths)) { | 432 | if (!atomic_read(&m->nr_valid_paths)) { |
433 | clear_bit(MPATHF_QUEUE_IO, &m->flags); | 433 | clear_bit(MPATHF_QUEUE_IO, &m->flags); |
@@ -466,7 +466,7 @@ check_current_pg: | |||
466 | */ | 466 | */ |
467 | do { | 467 | do { |
468 | list_for_each_entry(pg, &m->priority_groups, list) { | 468 | list_for_each_entry(pg, &m->priority_groups, list) { |
469 | if (pg->bypassed == bypassed) | 469 | if (pg->bypassed == !!bypassed) |
470 | continue; | 470 | continue; |
471 | pgpath = choose_path_in_pg(m, pg, nr_bytes); | 471 | pgpath = choose_path_in_pg(m, pg, nr_bytes); |
472 | if (!IS_ERR_OR_NULL(pgpath)) { | 472 | if (!IS_ERR_OR_NULL(pgpath)) { |
diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index 9d7275fb541a..6e702fc69a83 100644 --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c | |||
@@ -779,6 +779,10 @@ static void dm_old_request_fn(struct request_queue *q) | |||
779 | int srcu_idx; | 779 | int srcu_idx; |
780 | struct dm_table *map = dm_get_live_table(md, &srcu_idx); | 780 | struct dm_table *map = dm_get_live_table(md, &srcu_idx); |
781 | 781 | ||
782 | if (unlikely(!map)) { | ||
783 | dm_put_live_table(md, srcu_idx); | ||
784 | return; | ||
785 | } | ||
782 | ti = dm_table_find_target(map, pos); | 786 | ti = dm_table_find_target(map, pos); |
783 | dm_put_live_table(md, srcu_idx); | 787 | dm_put_live_table(md, srcu_idx); |
784 | } | 788 | } |