mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
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 <[email protected]> Reviewed-by: Takashi Iwai <[email protected]> Tested-by: Phil Carmody <[email protected]> Cc: Jeff Dike <[email protected]> Cc: Dan Williams <[email protected]> Cc: John W. Linville <[email protected]> Cc: Jing Huang <[email protected]> Cc: James E.J. Bottomley <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Johannes Berg <[email protected]> Cc: David S. Miller <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected]
This commit is contained in:
parent
dca4130639
commit
d6d1b650ae
7 changed files with 24 additions and 0 deletions
|
|
@ -289,10 +289,13 @@ static int if_usb_probe(struct usb_interface *intf,
|
|||
}
|
||||
|
||||
/* Upload firmware */
|
||||
kparam_block_sysfs_write(fw_name);
|
||||
if (__if_usb_prog_firmware(cardp, lbs_fw_name, BOOT_CMD_FW_BY_USB)) {
|
||||
kparam_unblock_sysfs_write(fw_name);
|
||||
lbs_deb_usbd(&udev->dev, "FW upload failed\n");
|
||||
goto err_prog_firmware;
|
||||
}
|
||||
kparam_unblock_sysfs_write(fw_name);
|
||||
|
||||
if (!(priv = lbs_add_card(cardp, &udev->dev)))
|
||||
goto err_prog_firmware;
|
||||
|
|
|
|||
|
|
@ -811,12 +811,15 @@ static int if_usb_prog_firmware(struct if_usb_card *cardp)
|
|||
|
||||
lbtf_deb_enter(LBTF_DEB_USB);
|
||||
|
||||
kparam_block_sysfs_write(fw_name);
|
||||
ret = request_firmware(&cardp->fw, lbtf_fw_name, &cardp->udev->dev);
|
||||
if (ret < 0) {
|
||||
pr_err("request_firmware() failed with %#x\n", ret);
|
||||
pr_err("firmware %s not found\n", lbtf_fw_name);
|
||||
kparam_unblock_sysfs_write(fw_name);
|
||||
goto done;
|
||||
}
|
||||
kparam_unblock_sysfs_write(fw_name);
|
||||
|
||||
if (check_fwfile_format(cardp->fw->data, cardp->fw->size))
|
||||
goto release_fw;
|
||||
|
|
|
|||
Loading…
Reference in a new issue