Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1612902
| From | Johan Hovold <johan@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 4/8] NFC: nfcmrvl: use nfc-device for firmware download |
| Date | 2017-03-30 12:30 +0200 |
| Message-ID | <tqFv4-4UX-21@gated-at.bofh.it> (permalink) |
| References | <tqFlo-4ME-21@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Use the nfc- rather than phy-device in firmware-management code that
needs a valid struct device.
This specifically fixes a NULL-pointer dereference in
nfcmrvl_fw_dnld_init() during registration when the underlying tty is
one end of a Unix98 pty.
Note that the driver still uses the phy device for any debugging, which
is fine for now.
Fixes: 3194c6870158 ("NFC: nfcmrvl: add firmware download support")
Cc: stable <stable@vger.kernel.org> # 4.4
Cc: Vincent Cuissard <cuissard@marvell.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/nfc/nfcmrvl/fw_dnld.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/nfc/nfcmrvl/fw_dnld.c b/drivers/nfc/nfcmrvl/fw_dnld.c
index f8dcdf4b24f6..af62c4c854f3 100644
--- a/drivers/nfc/nfcmrvl/fw_dnld.c
+++ b/drivers/nfc/nfcmrvl/fw_dnld.c
@@ -459,7 +459,7 @@ int nfcmrvl_fw_dnld_init(struct nfcmrvl_private *priv)
INIT_WORK(&priv->fw_dnld.rx_work, fw_dnld_rx_work);
snprintf(name, sizeof(name), "%s_nfcmrvl_fw_dnld_rx_wq",
- dev_name(priv->dev));
+ dev_name(&priv->ndev->nfc_dev->dev));
priv->fw_dnld.rx_wq = create_singlethread_workqueue(name);
if (!priv->fw_dnld.rx_wq)
return -ENOMEM;
@@ -496,6 +496,7 @@ int nfcmrvl_fw_dnld_start(struct nci_dev *ndev, const char *firmware_name)
{
struct nfcmrvl_private *priv = nci_get_drvdata(ndev);
struct nfcmrvl_fw_dnld *fw_dnld = &priv->fw_dnld;
+ int res;
if (!priv->support_fw_dnld)
return -ENOTSUPP;
@@ -511,7 +512,9 @@ int nfcmrvl_fw_dnld_start(struct nci_dev *ndev, const char *firmware_name)
*/
/* Retrieve FW binary */
- if (request_firmware(&fw_dnld->fw, firmware_name, priv->dev) < 0) {
+ res = request_firmware(&fw_dnld->fw, firmware_name,
+ &ndev->nfc_dev->dev);
+ if (res < 0) {
nfc_err(priv->dev, "failed to retrieve FW %s", firmware_name);
return -ENOENT;
}
--
2.12.2
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 0/8] NFC: fix device allocation and nfcmrvl crashes Johan Hovold <johan@kernel.org> - 2017-03-30 12:30 +0200 [PATCH v2 1/8] NFC: fix broken device allocation Johan Hovold <johan@kernel.org> - 2017-03-30 12:30 +0200 [PATCH v2 2/8] NFC: nfcmrvl_uart: add missing tty-device sanity check Johan Hovold <johan@kernel.org> - 2017-03-30 12:30 +0200 [PATCH v2 4/8] NFC: nfcmrvl: use nfc-device for firmware download Johan Hovold <johan@kernel.org> - 2017-03-30 12:30 +0200 [PATCH v2 7/8] NFC: nfcmrvl_usb: use interface as phy device Johan Hovold <johan@kernel.org> - 2017-03-30 12:30 +0200 [PATCH v2 5/8] NFC: nfcmrvl: fix firmware-management initialisation Johan Hovold <johan@kernel.org> - 2017-03-30 12:30 +0200
csiph-web