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

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

Merge "usb: gadget: f_ipc: Fix debugfs node null pointer dereference"

parents 746d4532 387f5c69
Loading
Loading
Loading
Loading
+25 −19
Original line number Diff line number Diff line
@@ -671,7 +671,11 @@ static ssize_t debug_read_stats(struct file *file, char __user *ubuf,
	int temp = 0;
	unsigned long flags;

	if (ipc_dev) {
	if (!ipc_dev || !ipc_dev->in || !ipc_dev->out) {
		pr_err("ipc_dev instance, or EPs not yet initialised\n");
		return 0;
	}

	spin_lock_irqsave(&ipc_dev->lock, flags);
	temp += scnprintf(buf + temp, PAGE_SIZE - temp,
			"endpoints: %s, %s\n"
@@ -685,7 +689,6 @@ static ssize_t debug_read_stats(struct file *file, char __user *ubuf,
			ipc_dev->pending_writes,
			ipc_dev->pending_reads);
	spin_unlock_irqrestore(&ipc_dev->lock, flags);
	}

	return simple_read_from_buffer(ubuf, count, ppos, buf, temp);
}
@@ -695,12 +698,15 @@ static ssize_t debug_reset_stats(struct file *file, const char __user *buf,
{
	unsigned long flags;

	if (ipc_dev) {
	if (!ipc_dev) {
		pr_err("ipc_dev instance not yet initialised\n");
		return count;
	}

	spin_lock_irqsave(&ipc_dev->lock, flags);
	ipc_dev->bytes_to_host = 0;
	ipc_dev->bytes_to_mdm = 0;
	spin_unlock_irqrestore(&ipc_dev->lock, flags);
	}

	return count;
}