Skip to content

Commit 9282690

Browse files
lixuzhaJiri Kosina
authored andcommitted
HID: intel-ish-hid: ipc: Fix dev_err usage with uninitialized dev->devc
The variable dev->devc in ish_dev_init was utilized by dev_err before it was properly assigned. To rectify this, the assignment of dev->devc has been moved to immediately follow memory allocation. Without this change "(NULL device *)" is printed for device information. Fixes: 8ae2f2b ("HID: intel-ish-hid: ipc: Fix potential use-after-free in work function") Fixes: ae02e5d ("HID: intel-ish-hid: ipc layer") Signed-off-by: Zhang Lixu <[email protected]> Acked-by: Srinivas Pandruvada <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 9c0f59e commit 9282690

File tree

1 file changed

+1
-1
lines changed
  • drivers/hid/intel-ish-hid/ipc

1 file changed

+1
-1
lines changed

drivers/hid/intel-ish-hid/ipc/ipc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,7 @@ struct ishtp_device *ish_dev_init(struct pci_dev *pdev)
948948
if (!dev)
949949
return NULL;
950950

951+
dev->devc = &pdev->dev;
951952
ishtp_device_init(dev);
952953

953954
init_waitqueue_head(&dev->wait_hw_ready);
@@ -983,7 +984,6 @@ struct ishtp_device *ish_dev_init(struct pci_dev *pdev)
983984
}
984985

985986
dev->ops = &ish_hw_ops;
986-
dev->devc = &pdev->dev;
987987
dev->mtu = IPC_PAYLOAD_SIZE - sizeof(struct ishtp_msg_hdr);
988988
return dev;
989989
}

0 commit comments

Comments
 (0)