Skip to content

Commit 50dcb6c

Browse files
committed
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()
2 parents 72df5eb + f5b0cba commit 50dcb6c

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

drivers/md/dm-crypt.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,26 +1534,26 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string
15341534
return PTR_ERR(key);
15351535
}
15361536

1537-
rcu_read_lock();
1537+
down_read(&key->sem);
15381538

15391539
ukp = user_key_payload(key);
15401540
if (!ukp) {
1541-
rcu_read_unlock();
1541+
up_read(&key->sem);
15421542
key_put(key);
15431543
kzfree(new_key_string);
15441544
return -EKEYREVOKED;
15451545
}
15461546

15471547
if (cc->key_size != ukp->datalen) {
1548-
rcu_read_unlock();
1548+
up_read(&key->sem);
15491549
key_put(key);
15501550
kzfree(new_key_string);
15511551
return -EINVAL;
15521552
}
15531553

15541554
memcpy(cc->key, ukp->data, cc->key_size);
15551555

1556-
rcu_read_unlock();
1556+
up_read(&key->sem);
15571557
key_put(key);
15581558

15591559
/* clear the flag since following operations may invalidate previously valid key */

drivers/md/dm-mpath.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ static struct pgpath *choose_pgpath(struct multipath *m, size_t nr_bytes)
427427
unsigned long flags;
428428
struct priority_group *pg;
429429
struct pgpath *pgpath;
430-
bool bypassed = true;
430+
unsigned bypassed = 1;
431431

432432
if (!atomic_read(&m->nr_valid_paths)) {
433433
clear_bit(MPATHF_QUEUE_IO, &m->flags);
@@ -466,7 +466,7 @@ static struct pgpath *choose_pgpath(struct multipath *m, size_t nr_bytes)
466466
*/
467467
do {
468468
list_for_each_entry(pg, &m->priority_groups, list) {
469-
if (pg->bypassed == bypassed)
469+
if (pg->bypassed == !!bypassed)
470470
continue;
471471
pgpath = choose_path_in_pg(m, pg, nr_bytes);
472472
if (!IS_ERR_OR_NULL(pgpath)) {

drivers/md/dm-rq.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,10 @@ static void dm_old_request_fn(struct request_queue *q)
779779
int srcu_idx;
780780
struct dm_table *map = dm_get_live_table(md, &srcu_idx);
781781

782+
if (unlikely(!map)) {
783+
dm_put_live_table(md, srcu_idx);
784+
return;
785+
}
782786
ti = dm_table_find_target(map, pos);
783787
dm_put_live_table(md, srcu_idx);
784788
}

0 commit comments

Comments
 (0)