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

Commit 19c9d762 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "dm: dm-req-crypt: fix null pointer reference"

parents f75b4f52 812c6796
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -867,7 +867,10 @@ static void req_crypt_dtr(struct dm_target *ti)
		destroy_workqueue(req_crypt_queue);
		req_crypt_queue = NULL;
	}
	if (dev) {
		dm_put_device(ti, dev);
		dev = NULL;
	}
}


+13 −2
Original line number Diff line number Diff line
@@ -558,8 +558,19 @@ EXPORT_SYMBOL_GPL(dm_set_device_limits);
 */
void dm_put_device(struct dm_target *ti, struct dm_dev *d)
{
	struct dm_dev_internal *dd = container_of(d, struct dm_dev_internal,
						  dm_dev);
	struct dm_dev_internal *dd;

	if (!ti) {
		DMERR("%s: dm_target pointer is NULL", __func__);
		return;
	}

	if (!d) {
		DMERR("%s: dm_dev pointer is NULL", __func__);
		return;
	}

	dd = container_of(d, struct dm_dev_internal, dm_dev);

	if (atomic_dec_and_test(&dd->count)) {
		close_dev(dd, ti->table->md);