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

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

Merge "power: qpnp-qg: Fix kernel memory corruption error in qg_device_read"

parents ebe65da2 41414e9f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2253,6 +2253,12 @@ static ssize_t qg_device_read(struct file *file, char __user *buf, size_t count,
	struct qpnp_qg *chip = file->private_data;
	unsigned long data_size = sizeof(chip->kdata);

	if (count < data_size) {
		pr_err("Invalid datasize %lu, expected lesser then %zu\n",
							data_size, count);
		return -EINVAL;
	}

	/* non-blocking access, return */
	if (!chip->data_ready && (file->f_flags & O_NONBLOCK))
		return 0;