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:
Rusty Russell 2010-08-11 23:04:27 -06:00
commit d6d1b650ae
7 changed files with 24 additions and 0 deletions

View file

@ -726,7 +726,9 @@ static int __devinit vt8623_pci_probe(struct pci_dev *dev, const struct pci_devi
/* Prepare startup mode */
kparam_block_sysfs_write(mode_option);
rc = fb_find_mode(&(info->var), info, mode_option, NULL, 0, NULL, 8);
kparam_unblock_sysfs_write(mode_option);
if (! ((rc == 1) || (rc == 2))) {
rc = -EINVAL;
dev_err(info->device, "mode %s not found\n", mode_option);