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
This commit is contained in:
@@ -103,6 +103,7 @@ ieee80211_rate_control_ops_get(const char *name)
|
||||
struct rate_control_ops *ops;
|
||||
const char *alg_name;
|
||||
|
||||
kparam_block_sysfs_write(ieee80211_default_rc_algo);
|
||||
if (!name)
|
||||
alg_name = ieee80211_default_rc_algo;
|
||||
else
|
||||
@@ -120,6 +121,7 @@ ieee80211_rate_control_ops_get(const char *name)
|
||||
/* try built-in one if specific alg requested but not found */
|
||||
if (!ops && strlen(CONFIG_MAC80211_RC_DEFAULT))
|
||||
ops = ieee80211_try_rate_control_ops_get(CONFIG_MAC80211_RC_DEFAULT);
|
||||
kparam_unblock_sysfs_write(ieee80211_default_rc_algo);
|
||||
|
||||
return ops;
|
||||
}
|
||||
|
Reference in New Issue
Block a user