Re: [PATCH] regmap: rbtree: Fix overlapping rbnodes.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed,  4 Sep 2013 11:01:41 +0800
Zhouping Liu <zliu@xxxxxxxxxx> wrote:

> Backporting for 3.10-stable. Adjusted context.

Looks good, thanks!

> From: David Jander <david@xxxxxxxxxxx>
> 
> commit 4e67fb5f5e336250db944921e3c68057d6203034 upstream.
> 
> Avoid overlapping register regions by making the initial blklen of a new
> node 1. If a register write occurs to a yet uncached register, that is
> lower than but near an existing node's base_reg, a new node is created
> and it's blklen is set to an arbitrary value (sizeof(*rbnode)). That may
> cause this node to overlap with another node. Those nodes should be merged,
> but this merge doesn't happen yet, so this patch at least makes the initial
> blklen small enough to avoid hitting the wrong node, which may otherwise
> lead to severe breakage.
> 
> Signed-off-by: David Jander <david@xxxxxxxxxxx>
> Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Zhouping Liu <zliu@xxxxxxxxxx>
> ---
>  drivers/base/regmap/regcache-rbtree.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/base/regmap/regcache-rbtree.c
> b/drivers/base/regmap/regcache-rbtree.c index 02f490b..bb8c3bb 100644
> --- a/drivers/base/regmap/regcache-rbtree.c
> +++ b/drivers/base/regmap/regcache-rbtree.c
> @@ -362,7 +362,7 @@ static int regcache_rbtree_write(struct regmap *map,
> unsigned int reg, rbnode = kzalloc(sizeof *rbnode, GFP_KERNEL);
>  		if (!rbnode)
>  			return -ENOMEM;
> -		rbnode->blklen = sizeof(*rbnode);
> +		rbnode->blklen = 1;
>  		rbnode->base_reg = reg;
>  		rbnode->block = kmalloc(rbnode->blklen *
> map->cache_word_size, GFP_KERNEL);



-- 
David Jander
Protonic Holland.
tel.: +31 (0) 229 212928
fax.: +31 (0) 229 210930
Factorij 36 / 1689 AL Zwaag
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]