drivers/scsi/qlogicfc.c: It's changes pci_find_device
Subsystems (2)
PATCH 1/1 drivers/scsi/qlogicfc.c: It's changes pci_find_device
Hi All,
I'm trying again. This time I checked whether the code isn't into the #ifdef or #ifndef block. :)
I hope that it's right. My apologies whether something is wrong. I only want to help the project.
I'm a newbie, so far. :)
usr/src/linux-kj/drivers/scsi/qlogicfc.c renamed from usr/src/linux/drivers/scsi/qlogicfc.c +1 -1
@@ -732,7 +732,7 @@ static int isp2x00_detect(Scsi_Host_Tempfor (i=0 ; i<2 ; i++){ pdev =NULL ; -while ((pdev =pci_find_device (PCI_VENDOR_ID_QLOGIC , device_ids[i], pdev))) { +while ((pdev =pci_get_device (PCI_VENDOR_ID_QLOGIC , device_ids[i], pdev))) {if (pci_enable_device (pdev))continue ;
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
Re: [KJ] [PATCH] drivers/scsi/qlogicfc.c: It's changes
Quoted 7 lines · Rodrigo P. do Nascimento
Hi All,
I'm trying again. This time I checked whether the code isn't into the #ifdef or #ifndef block. :)
I hope that it's right. My apologies whether something is wrong. I only want to help the project.
I'm a newbie, so far. :)
Nice try, but here is why this task is so tough :(
This patch will leak a reference count for the pci device.
usr/src/linux-kj/drivers/scsi/qlogicfc.c static int isp2x00_detect(Scsi_Host_Temp · line 735
Quoted 8 lines
usr/src/linux-kj/drivers/scsi/qlogicfc.c renamed from usr/src/linux/drivers/scsi/qlogicfc.c +1
-1@@ -732,7 +732,7 @@ static int isp2x00_detect(Scsi_Host_Tempfor (i=0 ; i<2 ; i++){ pdev =NULL ; -while ((pdev =pci_find_device (PCI_VENDOR_ID_QLOGIC , device_ids[i], pdev))) { +while ((pdev =pci_get_device (PCI_VENDOR_ID_QLOGIC , device_ids[i], pdev))) {
Please read the description of how pci_get_device() works. In short it increments the reference count of the pci_dev that is returned. Later on in this function, that pointer is saved off into a structure, which is fine. Problem happens when that larger structure is freed when the device or driver is removed. You need to decrement the usage count of that structure at that point in time.
Care to redo this?
thanks,
greg k-h
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
Re: [KJ] [PATCH] drivers/scsi/qlogicfc.c: It's changes
In reply to Rodrigo P. do NascimentoQuoted 8 lines · Greg KH
Please read the description of how
pci_get_device()works. In short it increments the reference count of thepci_devthat is returned. Later on in this function, that pointer is saved off into a structure, which is fine. Problem happens when that larger structure is freed when the device or driver is removed. You need to decrement the usage count of that structure at that point in time.Care to redo this?
Have we given up on getting people to convert drivers to the pci_driver model then?
Signature · 6 lines
"Next the statesmen will invent cheap lies, putting the blame upon the nation that is attacked, and every man will be glad of those conscience-soothing falsities, and will diligently study them, and refuse to examine any refutations of them; and thus he will by and by convince himself that the war is just, and will thank God for the better sleep he enjoys after this process of grotesque self-deception." -- Mark Twain
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
Re: [KJ] [PATCH] drivers/scsi/qlogicfc.c: It's changes
In reply to Rodrigo P. do NascimentoQuoted 8 lines · Matthew Wilcox
Quoted 7 lines · Greg KH
Please read the description of how
pci_get_device()works. In short it increments the reference count of thepci_devthat is returned. Later on in this function, that pointer is saved off into a structure, which is fine. Problem happens when that larger structure is freed when the device or driver is removed. You need to decrement the usage count of that structure at that point in time.
Quoted 4 lines
Quoted 1 line
Care to redo this?
Have we given up on getting people to convert drivers to the
pci_drivermodel then?
Not at all. But that's a much harder task :(
thanks,
greg k-h
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
Re: [KJ] [PATCH] drivers/scsi/qlogicfc.c: It's changes
In reply to Rodrigo P. do NascimentoQuoted 10 lines · Greg KH
Quoted 9 lines · Matthew Wilcox
Quoted 8 lines · Greg KH
Please read the description of how
pci_get_device()works. In short it increments the reference count of thepci_devthat is returned. Later on in this function, that pointer is saved off into a structure, which is fine. Problem happens when that larger structure is freed when the device or driver is removed. You need to decrement the usage count of that structure at that point in time.Care to redo this?
qlogicfc is nearly dead, don't bother updating it, use the qla2xxx driver instead. hch sent a patch to mark it broken, AFAICT patch was not included anywhere, mabye because some people are still using it (well at least one open-ended complaint on the thread).
Reference this thread (from February 2005):
http://marc.theaimsgroup.com/?l=linux-scsi&m=110805956618612&w=2
-- Patrick Mansfield
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
Re: [KJ] [PATCH] drivers/scsi/qlogicfc.c: It's changes
In reply to Rodrigo P. do Nascimentoqla2xxx is OK!
So, I need to redo qlogicfc.c, or not?
--
Rodrigo Nascimento
Quoted 31 lines · Patrick Mansfield
Quoted 10 lines · Greg KH
Quoted 9 lines · Matthew Wilcox
Quoted 8 lines · Greg KH
Please read the description of how
pci_get_device()works. In short it increments the reference count of thepci_devthat is returned. Later on in this function, that pointer is saved off into a structure, which is fine. Problem happens when that larger structure is freed when the device or driver is removed. You need to decrement the usage count of that structure at that point in time.Care to redo this?
qlogicfc is nearly dead, don't bother updating it, use the qla2xxx driver instead. hch sent a patch to mark it broken, AFAICT patch was not included anywhere, mabye because some people are still using it (well at least one open-ended complaint on the thread).
Reference this thread (from February 2005):
http://marc.theaimsgroup.com/?l=linux-scsi&m0805956618612&w=2
-- Patrick Mansfield
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
Signature · 6 lines
Rodrigo Nascimento _______________________________________________ Kernel-janitors mailing list [email protected] https://lists.osdl.org/mailman/listinfo/kernel-janitors