* [PATCH V2] drivers: regmap: regcache-rbtree.c: Fix overlapping rbnodes.
@ 2013-08-21 15:37 David Jander
2013-08-21 16:10 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: David Jander @ 2013-08-21 15:37 UTC (permalink / raw)
To: Dimitris Papastamos; +Cc: Mark Brown, linux-kernel, David Jander
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@protonic.nl>
---
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 5c1435c..0fccc99 100644
--- a/drivers/base/regmap/regcache-rbtree.c
+++ b/drivers/base/regmap/regcache-rbtree.c
@@ -332,7 +332,7 @@ regcache_rbtree_node_alloc(struct regmap *map, unsigned int reg)
}
if (!rbnode->blklen) {
- rbnode->blklen = sizeof(*rbnode);
+ rbnode->blklen = 1;
rbnode->base_reg = reg;
}
--
1.8.1.2
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH V2] drivers: regmap: regcache-rbtree.c: Fix overlapping rbnodes.
2013-08-21 15:37 [PATCH V2] drivers: regmap: regcache-rbtree.c: Fix overlapping rbnodes David Jander
@ 2013-08-21 16:10 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2013-08-21 16:10 UTC (permalink / raw)
To: David Jander; +Cc: Dimitris Papastamos, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 634 bytes --]
On Wed, Aug 21, 2013 at 05:37:22PM +0200, David Jander wrote:
> 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.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-08-21 16:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-21 15:37 [PATCH V2] drivers: regmap: regcache-rbtree.c: Fix overlapping rbnodes David Jander
2013-08-21 16:10 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®