diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2010-08-12 01:04:27 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2010-08-11 09:34:31 -0400 |
commit | d6d1b650ae6acce73d55dd0246de22180303ae73 (patch) | |
tree | 7a342999c119a5ee6395966cee91ddf5186f5665 /drivers | |
parent | dca41306395eab37e222ff9e72765e692fcc7251 (diff) |
param: simple locking for sysfs-writable charp parameters
Since the writing to sysfs can free the old one, we need to block that
when we access the charp variables.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Dan Williams <dcbw@redhat.com>
Cc: John W. Linville <linville@tuxdriver.com>
Cc: Jing Huang <huangj@brocade.com>
Cc: James E.J. Bottomley <James.Bottomley@suse.de>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: David S. Miller <davem@davemloft.net>
Cc: user-mode-linux-devel@lists.sourceforge.net
Cc: libertas-dev@lists.infradead.org
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: linux-scsi@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/libertas/if_usb.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/libertas_tf/if_usb.c | 3 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad.c | 2 | ||||
-rw-r--r-- | drivers/usb/atm/ueagle-atm.c | 2 | ||||
-rw-r--r-- | drivers/video/vt8623fb.c | 2 |
5 files changed, 12 insertions, 0 deletions
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 07ece9d26c63..3ff61063671a 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c | |||
@@ -289,10 +289,13 @@ static int if_usb_probe(struct usb_interface *intf, | |||
289 | } | 289 | } |
290 | 290 | ||
291 | /* Upload firmware */ | 291 | /* Upload firmware */ |
292 | kparam_block_sysfs_write(fw_name); | ||
292 | if (__if_usb_prog_firmware(cardp, lbs_fw_name, BOOT_CMD_FW_BY_USB)) { | 293 | if (__if_usb_prog_firmware(cardp, lbs_fw_name, BOOT_CMD_FW_BY_USB)) { |
294 | kparam_unblock_sysfs_write(fw_name); | ||
293 | lbs_deb_usbd(&udev->dev, "FW upload failed\n"); | 295 | lbs_deb_usbd(&udev->dev, "FW upload failed\n"); |
294 | goto err_prog_firmware; | 296 | goto err_prog_firmware; |
295 | } | 297 | } |
298 | kparam_unblock_sysfs_write(fw_name); | ||
296 | 299 | ||
297 | if (!(priv = lbs_add_card(cardp, &udev->dev))) | 300 | if (!(priv = lbs_add_card(cardp, &udev->dev))) |
298 | goto err_prog_firmware; | 301 | goto err_prog_firmware; |
diff --git a/drivers/net/wireless/libertas_tf/if_usb.c b/drivers/net/wireless/libertas_tf/if_usb.c index b172f5d87a3b..41a4f214ade1 100644 --- a/drivers/net/wireless/libertas_tf/if_usb.c +++ b/drivers/net/wireless/libertas_tf/if_usb.c | |||
@@ -811,12 +811,15 @@ static int if_usb_prog_firmware(struct if_usb_card *cardp) | |||
811 | 811 | ||
812 | lbtf_deb_enter(LBTF_DEB_USB); | 812 | lbtf_deb_enter(LBTF_DEB_USB); |
813 | 813 | ||
814 | kparam_block_sysfs_write(fw_name); | ||
814 | ret = request_firmware(&cardp->fw, lbtf_fw_name, &cardp->udev->dev); | 815 | ret = request_firmware(&cardp->fw, lbtf_fw_name, &cardp->udev->dev); |
815 | if (ret < 0) { | 816 | if (ret < 0) { |
816 | pr_err("request_firmware() failed with %#x\n", ret); | 817 | pr_err("request_firmware() failed with %#x\n", ret); |
817 | pr_err("firmware %s not found\n", lbtf_fw_name); | 818 | pr_err("firmware %s not found\n", lbtf_fw_name); |
819 | kparam_unblock_sysfs_write(fw_name); | ||
818 | goto done; | 820 | goto done; |
819 | } | 821 | } |
822 | kparam_unblock_sysfs_write(fw_name); | ||
820 | 823 | ||
821 | if (check_fwfile_format(cardp->fw->data, cardp->fw->size)) | 824 | if (check_fwfile_format(cardp->fw->data, cardp->fw->size)) |
822 | goto release_fw; | 825 | goto release_fw; |
diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index 915a29d6c7ad..ca04cc9d332f 100644 --- a/drivers/scsi/bfa/bfad.c +++ b/drivers/scsi/bfa/bfad.c | |||
@@ -788,6 +788,7 @@ bfad_drv_init(struct bfad_s *bfad) | |||
788 | memset(&driver_info, 0, sizeof(driver_info)); | 788 | memset(&driver_info, 0, sizeof(driver_info)); |
789 | strncpy(driver_info.version, BFAD_DRIVER_VERSION, | 789 | strncpy(driver_info.version, BFAD_DRIVER_VERSION, |
790 | sizeof(driver_info.version) - 1); | 790 | sizeof(driver_info.version) - 1); |
791 | __kernel_param_lock(); | ||
791 | if (host_name) | 792 | if (host_name) |
792 | strncpy(driver_info.host_machine_name, host_name, | 793 | strncpy(driver_info.host_machine_name, host_name, |
793 | sizeof(driver_info.host_machine_name) - 1); | 794 | sizeof(driver_info.host_machine_name) - 1); |
@@ -797,6 +798,7 @@ bfad_drv_init(struct bfad_s *bfad) | |||
797 | if (os_patch) | 798 | if (os_patch) |
798 | strncpy(driver_info.host_os_patch, os_patch, | 799 | strncpy(driver_info.host_os_patch, os_patch, |
799 | sizeof(driver_info.host_os_patch) - 1); | 800 | sizeof(driver_info.host_os_patch) - 1); |
801 | __kernel_param_unlock(); | ||
800 | 802 | ||
801 | strncpy(driver_info.os_device_name, bfad->pci_name, | 803 | strncpy(driver_info.os_device_name, bfad->pci_name, |
802 | sizeof(driver_info.os_device_name - 1)); | 804 | sizeof(driver_info.os_device_name - 1)); |
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c index 5b3f555e01c9..ea071a5b6eee 100644 --- a/drivers/usb/atm/ueagle-atm.c +++ b/drivers/usb/atm/ueagle-atm.c | |||
@@ -1577,6 +1577,7 @@ static void cmvs_file_name(struct uea_softc *sc, char *const cmv_name, int ver) | |||
1577 | char file_arr[] = "CMVxy.bin"; | 1577 | char file_arr[] = "CMVxy.bin"; |
1578 | char *file; | 1578 | char *file; |
1579 | 1579 | ||
1580 | kparam_block_sysfs_write(cmv_file); | ||
1580 | /* set proper name corresponding modem version and line type */ | 1581 | /* set proper name corresponding modem version and line type */ |
1581 | if (cmv_file[sc->modem_index] == NULL) { | 1582 | if (cmv_file[sc->modem_index] == NULL) { |
1582 | if (UEA_CHIP_VERSION(sc) == ADI930) | 1583 | if (UEA_CHIP_VERSION(sc) == ADI930) |
@@ -1595,6 +1596,7 @@ static void cmvs_file_name(struct uea_softc *sc, char *const cmv_name, int ver) | |||
1595 | strlcat(cmv_name, file, UEA_FW_NAME_MAX); | 1596 | strlcat(cmv_name, file, UEA_FW_NAME_MAX); |
1596 | if (ver == 2) | 1597 | if (ver == 2) |
1597 | strlcat(cmv_name, ".v2", UEA_FW_NAME_MAX); | 1598 | strlcat(cmv_name, ".v2", UEA_FW_NAME_MAX); |
1599 | kparam_unblock_sysfs_write(cmv_file); | ||
1598 | } | 1600 | } |
1599 | 1601 | ||
1600 | static int request_cmvs_old(struct uea_softc *sc, | 1602 | static int request_cmvs_old(struct uea_softc *sc, |
diff --git a/drivers/video/vt8623fb.c b/drivers/video/vt8623fb.c index d31dc96f838a..85d76ec4c63e 100644 --- a/drivers/video/vt8623fb.c +++ b/drivers/video/vt8623fb.c | |||
@@ -726,7 +726,9 @@ static int __devinit vt8623_pci_probe(struct pci_dev *dev, const struct pci_devi | |||
726 | 726 | ||
727 | /* Prepare startup mode */ | 727 | /* Prepare startup mode */ |
728 | 728 | ||
729 | kparam_block_sysfs_write(mode_option); | ||
729 | rc = fb_find_mode(&(info->var), info, mode_option, NULL, 0, NULL, 8); | 730 | rc = fb_find_mode(&(info->var), info, mode_option, NULL, 0, NULL, 8); |
731 | kparam_unblock_sysfs_write(mode_option); | ||
730 | if (! ((rc == 1) || (rc == 2))) { | 732 | if (! ((rc == 1) || (rc == 2))) { |
731 | rc = -EINVAL; | 733 | rc = -EINVAL; |
732 | dev_err(info->device, "mode %s not found\n", mode_option); | 734 | dev_err(info->device, "mode %s not found\n", mode_option); |