Commit 50dcb6cd authored by Linus Torvalds's avatar Linus Torvalds

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()
parents 72df5eba f5b0cba8
...@@ -1534,18 +1534,18 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string ...@@ -1534,18 +1534,18 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string
return PTR_ERR(key); return PTR_ERR(key);
} }
rcu_read_lock(); down_read(&key->sem);
ukp = user_key_payload(key); ukp = user_key_payload(key);
if (!ukp) { if (!ukp) {
rcu_read_unlock(); up_read(&key->sem);
key_put(key); key_put(key);
kzfree(new_key_string); kzfree(new_key_string);
return -EKEYREVOKED; return -EKEYREVOKED;
} }
if (cc->key_size != ukp->datalen) { if (cc->key_size != ukp->datalen) {
rcu_read_unlock(); up_read(&key->sem);
key_put(key); key_put(key);
kzfree(new_key_string); kzfree(new_key_string);
return -EINVAL; return -EINVAL;
...@@ -1553,7 +1553,7 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string ...@@ -1553,7 +1553,7 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string
memcpy(cc->key, ukp->data, cc->key_size); memcpy(cc->key, ukp->data, cc->key_size);
rcu_read_unlock(); up_read(&key->sem);
key_put(key); key_put(key);
/* clear the flag since following operations may invalidate previously valid key */ /* clear the flag since following operations may invalidate previously valid key */
......
...@@ -427,7 +427,7 @@ static struct pgpath *choose_pgpath(struct multipath *m, size_t nr_bytes) ...@@ -427,7 +427,7 @@ static struct pgpath *choose_pgpath(struct multipath *m, size_t nr_bytes)
unsigned long flags; unsigned long flags;
struct priority_group *pg; struct priority_group *pg;
struct pgpath *pgpath; struct pgpath *pgpath;
bool bypassed = true; unsigned bypassed = 1;
if (!atomic_read(&m->nr_valid_paths)) { if (!atomic_read(&m->nr_valid_paths)) {
clear_bit(MPATHF_QUEUE_IO, &m->flags); clear_bit(MPATHF_QUEUE_IO, &m->flags);
...@@ -466,7 +466,7 @@ static struct pgpath *choose_pgpath(struct multipath *m, size_t nr_bytes) ...@@ -466,7 +466,7 @@ static struct pgpath *choose_pgpath(struct multipath *m, size_t nr_bytes)
*/ */
do { do {
list_for_each_entry(pg, &m->priority_groups, list) { list_for_each_entry(pg, &m->priority_groups, list) {
if (pg->bypassed == bypassed) if (pg->bypassed == !!bypassed)
continue; continue;
pgpath = choose_path_in_pg(m, pg, nr_bytes); pgpath = choose_path_in_pg(m, pg, nr_bytes);
if (!IS_ERR_OR_NULL(pgpath)) { if (!IS_ERR_OR_NULL(pgpath)) {
......
...@@ -779,6 +779,10 @@ static void dm_old_request_fn(struct request_queue *q) ...@@ -779,6 +779,10 @@ static void dm_old_request_fn(struct request_queue *q)
int srcu_idx; int srcu_idx;
struct dm_table *map = dm_get_live_table(md, &srcu_idx); struct dm_table *map = dm_get_live_table(md, &srcu_idx);
if (unlikely(!map)) {
dm_put_live_table(md, srcu_idx);
return;
}
ti = dm_table_find_target(map, pos); ti = dm_table_find_target(map, pos);
dm_put_live_table(md, srcu_idx); dm_put_live_table(md, srcu_idx);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment