aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-05-08 23:38:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-05-08 23:38:21 -0400
commit5d5df5ee7cdb77bfdac3703fd7a6bae5e3e4ab36 (patch)
tree925d6dc51fc02ac46c42fccbbe36f0875d15ca03
parent1daac193f21d6e3d0adc528a06a7e11522d4254d (diff)
parentcb31ef485dd4c6a205d1064b42027f82076d00c8 (diff)
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"
-rw-r--r--drivers/md/dm-crypt.c12
-rw-r--r--init/do_mounts.c5
2 files changed, 9 insertions, 8 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 9eeea196328a..5503e43e5f28 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -925,10 +925,11 @@ static int crypt_convert(struct crypt_config *cc,
925 925
926 switch (r) { 926 switch (r) {
927 /* async */ 927 /* async */
928 case -EINPROGRESS:
929 case -EBUSY: 928 case -EBUSY:
930 wait_for_completion(&ctx->restart); 929 wait_for_completion(&ctx->restart);
931 reinit_completion(&ctx->restart); 930 reinit_completion(&ctx->restart);
931 /* fall through*/
932 case -EINPROGRESS:
932 ctx->req = NULL; 933 ctx->req = NULL;
933 ctx->cc_sector++; 934 ctx->cc_sector++;
934 continue; 935 continue;
@@ -1345,8 +1346,10 @@ static void kcryptd_async_done(struct crypto_async_request *async_req,
1345 struct dm_crypt_io *io = container_of(ctx, struct dm_crypt_io, ctx); 1346 struct dm_crypt_io *io = container_of(ctx, struct dm_crypt_io, ctx);
1346 struct crypt_config *cc = io->cc; 1347 struct crypt_config *cc = io->cc;
1347 1348
1348 if (error == -EINPROGRESS) 1349 if (error == -EINPROGRESS) {
1350 complete(&ctx->restart);
1349 return; 1351 return;
1352 }
1350 1353
1351 if (!error && cc->iv_gen_ops && cc->iv_gen_ops->post) 1354 if (!error && cc->iv_gen_ops && cc->iv_gen_ops->post)
1352 error = cc->iv_gen_ops->post(cc, iv_of_dmreq(cc, dmreq), dmreq); 1355 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,
1357 crypt_free_req(cc, req_of_dmreq(cc, dmreq), io->base_bio); 1360 crypt_free_req(cc, req_of_dmreq(cc, dmreq), io->base_bio);
1358 1361
1359 if (!atomic_dec_and_test(&ctx->cc_pending)) 1362 if (!atomic_dec_and_test(&ctx->cc_pending))
1360 goto done; 1363 return;
1361 1364
1362 if (bio_data_dir(io->base_bio) == READ) 1365 if (bio_data_dir(io->base_bio) == READ)
1363 kcryptd_crypt_read_done(io); 1366 kcryptd_crypt_read_done(io);
1364 else 1367 else
1365 kcryptd_crypt_write_io_submit(io, 1); 1368 kcryptd_crypt_write_io_submit(io, 1);
1366done:
1367 if (!completion_done(&ctx->restart))
1368 complete(&ctx->restart);
1369} 1369}
1370 1370
1371static void kcryptd_crypt(struct work_struct *work) 1371static void kcryptd_crypt(struct work_struct *work)
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 8369ffa5f33d..a95bbdb2a502 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -225,10 +225,11 @@ dev_t name_to_dev_t(const char *name)
225#endif 225#endif
226 226
227 if (strncmp(name, "/dev/", 5) != 0) { 227 if (strncmp(name, "/dev/", 5) != 0) {
228 unsigned maj, min; 228 unsigned maj, min, offset;
229 char dummy; 229 char dummy;
230 230
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)) {
232 res = MKDEV(maj, min); 233 res = MKDEV(maj, min);
233 if (maj != MAJOR(res) || min != MINOR(res)) 234 if (maj != MAJOR(res) || min != MINOR(res))
234 goto fail; 235 goto fail;