Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d5df5ee authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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"
parents 1daac193 cb31ef48
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -925,10 +925,11 @@ static int crypt_convert(struct crypt_config *cc,


		switch (r) {
		switch (r) {
		/* async */
		/* async */
		case -EINPROGRESS:
		case -EBUSY:
		case -EBUSY:
			wait_for_completion(&ctx->restart);
			wait_for_completion(&ctx->restart);
			reinit_completion(&ctx->restart);
			reinit_completion(&ctx->restart);
			/* fall through*/
		case -EINPROGRESS:
			ctx->req = NULL;
			ctx->req = NULL;
			ctx->cc_sector++;
			ctx->cc_sector++;
			continue;
			continue;
@@ -1345,8 +1346,10 @@ static void kcryptd_async_done(struct crypto_async_request *async_req,
	struct dm_crypt_io *io = container_of(ctx, struct dm_crypt_io, ctx);
	struct dm_crypt_io *io = container_of(ctx, struct dm_crypt_io, ctx);
	struct crypt_config *cc = io->cc;
	struct crypt_config *cc = io->cc;


	if (error == -EINPROGRESS)
	if (error == -EINPROGRESS) {
		complete(&ctx->restart);
		return;
		return;
	}


	if (!error && cc->iv_gen_ops && cc->iv_gen_ops->post)
	if (!error && cc->iv_gen_ops && cc->iv_gen_ops->post)
		error = cc->iv_gen_ops->post(cc, iv_of_dmreq(cc, dmreq), dmreq);
		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,
	crypt_free_req(cc, req_of_dmreq(cc, dmreq), io->base_bio);
	crypt_free_req(cc, req_of_dmreq(cc, dmreq), io->base_bio);


	if (!atomic_dec_and_test(&ctx->cc_pending))
	if (!atomic_dec_and_test(&ctx->cc_pending))
		goto done;
		return;


	if (bio_data_dir(io->base_bio) == READ)
	if (bio_data_dir(io->base_bio) == READ)
		kcryptd_crypt_read_done(io);
		kcryptd_crypt_read_done(io);
	else
	else
		kcryptd_crypt_write_io_submit(io, 1);
		kcryptd_crypt_write_io_submit(io, 1);
done:
	if (!completion_done(&ctx->restart))
		complete(&ctx->restart);
}
}


static void kcryptd_crypt(struct work_struct *work)
static void kcryptd_crypt(struct work_struct *work)
+3 −2
Original line number Original line Diff line number Diff line
@@ -225,10 +225,11 @@ dev_t name_to_dev_t(const char *name)
#endif
#endif


	if (strncmp(name, "/dev/", 5) != 0) {
	if (strncmp(name, "/dev/", 5) != 0) {
		unsigned maj, min;
		unsigned maj, min, offset;
		char dummy;
		char dummy;


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