Skip to content

Commit 5d5df5e

Browse files
committed
Merge tag 'dm-4.1-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
Pull device mapper fixes from Mike Snitzer: "Two additional fixes for changes introduced via DM during the 4.1 merge window. The first reverts a dm-crypt change that wasn't correct. The second fixes a device format regression that impacted userspace" * tag 'dm-4.1-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: init: fix regression by supporting devices with major:minor:offset format Revert "dm crypt: fix deadlock when async crypto algorithm returns -EBUSY"
2 parents 1daac19 + cb31ef4 commit 5d5df5e

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

drivers/md/dm-crypt.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -925,10 +925,11 @@ static int crypt_convert(struct crypt_config *cc,
925925

926926
switch (r) {
927927
/* async */
928-
case -EINPROGRESS:
929928
case -EBUSY:
930929
wait_for_completion(&ctx->restart);
931930
reinit_completion(&ctx->restart);
931+
/* fall through*/
932+
case -EINPROGRESS:
932933
ctx->req = NULL;
933934
ctx->cc_sector++;
934935
continue;
@@ -1345,8 +1346,10 @@ static void kcryptd_async_done(struct crypto_async_request *async_req,
13451346
struct dm_crypt_io *io = container_of(ctx, struct dm_crypt_io, ctx);
13461347
struct crypt_config *cc = io->cc;
13471348

1348-
if (error == -EINPROGRESS)
1349+
if (error == -EINPROGRESS) {
1350+
complete(&ctx->restart);
13491351
return;
1352+
}
13501353

13511354
if (!error && cc->iv_gen_ops && cc->iv_gen_ops->post)
13521355
error = cc->iv_gen_ops->post(cc, iv_of_dmreq(cc, dmreq), dmreq);
@@ -1357,15 +1360,12 @@ static void kcryptd_async_done(struct crypto_async_request *async_req,
13571360
crypt_free_req(cc, req_of_dmreq(cc, dmreq), io->base_bio);
13581361

13591362
if (!atomic_dec_and_test(&ctx->cc_pending))
1360-
goto done;
1363+
return;
13611364

13621365
if (bio_data_dir(io->base_bio) == READ)
13631366
kcryptd_crypt_read_done(io);
13641367
else
13651368
kcryptd_crypt_write_io_submit(io, 1);
1366-
done:
1367-
if (!completion_done(&ctx->restart))
1368-
complete(&ctx->restart);
13691369
}
13701370

13711371
static void kcryptd_crypt(struct work_struct *work)

init/do_mounts.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,11 @@ dev_t name_to_dev_t(const char *name)
225225
#endif
226226

227227
if (strncmp(name, "/dev/", 5) != 0) {
228-
unsigned maj, min;
228+
unsigned maj, min, offset;
229229
char dummy;
230230

231-
if (sscanf(name, "%u:%u%c", &maj, &min, &dummy) == 2) {
231+
if ((sscanf(name, "%u:%u%c", &maj, &min, &dummy) == 2) ||
232+
(sscanf(name, "%u:%u:%u:%c", &maj, &min, &offset, &dummy) == 3)) {
232233
res = MKDEV(maj, min);
233234
if (maj != MAJOR(res) || min != MINOR(res))
234235
goto fail;

0 commit comments

Comments
 (0)