From: bugzilla-daemon@bugzilla.kernel.org
To: linux-scsi@kernel.org
Subject: [Bug 195489] New: esas2r: unchecked return value of pci_enable_device() in function esas2r_resume()
Date: Sat, 22 Apr 2017 14:38:51 +0000 [thread overview]
Message-ID: <bug-195489-11613@https.bugzilla.kernel.org/> (raw)
https://bugzilla.kernel.org/show_bug.cgi?id=195489
Bug ID: 195489
Summary: esas2r: unchecked return value of pci_enable_device()
in function esas2r_resume()
Product: SCSI Drivers
Version: 2.5
Kernel Version: linux-4.11-rc7
Hardware: All
OS: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: Other
Assignee: scsi_drivers-other@kernel-bugs.osdl.org
Reporter: bianpan2010@ruc.edu.cn
Regression: No
In file drivers/scsi/esas2r/esas2r_init.c, function esas2r_resume() calls the
function pci_enable_device() (at line 730), but forget to detect its return
value. The function pci_enable_device() will return a negative value on errors.
The return value should be validated before continuing. The related code
snippet is shown as follows.
esas2r_resume @@ drivers/scsi/esas2r/esas2r_init.c: 710
710 int esas2r_resume(struct pci_dev *pdev)
711 {
712 struct Scsi_Host *host = pci_get_drvdata(pdev);
...
730 rez = pci_enable_device(pdev);
731 pci_set_master(pdev);
732
733 if (!a) {
734 rez = -ENODEV;
735 goto error_exit;
736 }
...
774 error_exit:
775 esas2r_log_dev(ESAS2R_LOG_CRIT, &(pdev->dev), "esas2r_resume(): %d",
776 rez);
777 return rez;
778 }
Generally, the function pci_enable_device() is called in the following way.
ide_pci_resume @@ drivers/ide/setup-pci.c: 645
645 int ide_pci_resume(struct pci_dev *dev)
646 {
647 struct ide_host *host = pci_get_drvdata(dev);
648 int rc;
649
650 pci_set_power_state(dev, PCI_D0);
651
652 rc = pci_enable_device(dev);
653 if (rc)
654 return rc;
655
656 pci_restore_state(dev);
657 pci_set_master(dev);
658
659 if (host->init_chipset)
660 host->init_chipset(dev);
661
662 return 0;
663 }
Thanks for your attention!
Pan Bian
--
You are receiving this mail because:
You are watching the assignee of the bug.
reply other threads:[~2017-04-22 14:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-195489-11613@https.bugzilla.kernel.org/ \
--to=bugzilla-daemon@bugzilla.kernel.org \
--cc=linux-scsi@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.