]> git.ipfire.org Git - people/arne_f/kernel.git/commit
i7core_edac: Fix PCI device reference count
authorJean Delvare <jdelvare@suse.de>
Mon, 24 Feb 2014 08:39:27 +0000 (09:39 +0100)
committerJiri Slaby <jslaby@suse.cz>
Wed, 5 Mar 2014 16:13:47 +0000 (17:13 +0100)
commitef0f10d829ab82b2a2cd8e2dca317027d2110237
treec3437f6e35c8b4e255a76921102290a3b359b9f2
parentbb0a8dd760df353a9ca6c52ddb07d959272595ca
i7core_edac: Fix PCI device reference count

commit c0f5eeed0f4cef4f05b74883a7160e7edde58b6a upstream.

The reference count changes done by pci_get_device can be a little
misleading when the usage diverges from the most common scheme. The
reference count of the device passed as the last parameter is always
decreased, even if the function returns no new device. So if we are
going to try alternative device IDs, we must manually increment the
device reference count before each retry. If we don't, we end up
decreasing the reference count, and after a few modprobe/rmmod cycles
the PCI devices will vanish.

In other words and as Alan put it: without this fix the EDAC code
corrupts the PCI device list.

This fixes kernel bug #50491:
https://bugzilla.kernel.org/show_bug.cgi?id=50491

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Link: http://lkml.kernel.org/r/20140224093927.7659dd9d@endymion.delvare
Reviewed-by: Alan Cox <alan@linux.intel.com>
Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
Cc: Doug Thompson <dougthompson@xmission.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/edac/i7core_edac.c