[alsa-devel] [PATCH v2 1/2] remgap: Fix possible sleep-in-atomic in regmap_bulk_write()

Mark Brown broonie at kernel.org
Tue Mar 18 13:22:18 CET 2014


On Tue, Mar 18, 2014 at 12:58:33PM +0100, Takashi Iwai wrote:

>  		wval = kmemdup(val, val_count * val_bytes, GFP_KERNEL);
>  		if (!wval) {
> -			ret = -ENOMEM;
>  			dev_err(map->dev, "Error in memory allocation\n");
> -			goto out;
> +			return -ENOMEM;
>  		}
> +		map->lock(map->lock_arg);
>  		for (i = 0; i < val_count * val_bytes; i += val_bytes)
>  			map->format.parse_inplace(wval + i);
>  
>  		ret = _regmap_raw_write(map, reg, wval, val_bytes * val_count);
> +		map->unlock(map->lock_arg);

If we're reducing the locking region here then we should take the lock
after doing the parse_inplace() to reduce the locked region.  Nothing
else can be referring to the data since we only just allocated it.  I'll
fix that by hand and apply.

Please also send things to the list for the subsystem (linux-kernel if
there's not a specific one).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20140318/9efd3833/attachment.sig>


More information about the Alsa-devel mailing list