2022-02-28 07:11:51

by Zheyu Ma

[permalink] [raw]
Subject: [BUG] media: solo6x10: Disabling already-disabled device in free_solo_dev

Hi,

I found a bug during the process of probing.

The function call of v4l2_device_register() maybe failed, and then the
driver will call free_sole_dev(). In this function, the driver will do
some cleanup work such as pci_disable_device(), but now the PCI device
is not enabled ever, which can cause a warning of the kernel.

The root cause of this bug is that the driver does not handle the
failures properly, the driver should split the error handling and
handle it differently depending on the error.

The following log can reveal the bug:
[ 115.920219] solo6x10 0000:00:04.0: disabling already-disabled device
[ 115.920255] WARNING: CPU: 5 PID: 489 at drivers/pci/pci.c:2202
pci_disable_device+0x27a/0x380
[ 115.923962] RIP: 0010:pci_disable_device+0x27a/0x380
[ 115.932590] Call Trace:
[ 115.932806] <TASK>
[ 115.932990] free_solo_dev+0x1d4/0x270 [solo6x10]
[ 115.933413] ? solo_pci_probe+0x165/0xb70 [solo6x10]
[ 115.933865] solo_pci_probe+0x21b/0xb70 [solo6x10]
[ 115.934954] local_pci_probe+0x13f/0x210
[ 115.935288] pci_device_probe+0x34c/0x6d0

Regards,
Zheyu Ma