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

Commit 7206a4c8 authored by Guang Jian Zeng's avatar Guang Jian Zeng
Browse files

usb: ks_bridge: Check dev status in ksb_fs_release function



If the ksb device is disconnected before calling ksb_fs_release,
the device pointer may already be freed, which will lead to a
crash when calling dev_dbg. Fix this by checking the connection
status before calling dev_dbg.

CRs-fixed: 661871
Change-Id: I04c9e861f519f5fcbe57a8c4edf1038647c09783
Signed-off-by: default avatarGuang Jian Zeng <gzeng@codeaurora.org>
parent 0c694e68
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -421,6 +421,7 @@ static int ksb_fs_release(struct inode *ip, struct file *fp)
{
	struct ks_bridge	*ksb = fp->private_data;

	if (test_bit(USB_DEV_CONNECTED, &ksb->flags))
		dev_dbg(ksb->device, ":%s", ksb->id_info.name);
	dbg_log_event(ksb, "FS-RELEASE", 0, 0);