[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20111222.223738.869939610976955478.davem@davemloft.net>
Date: Thu, 22 Dec 2011 22:37:38 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: xi.wang@...il.com
Cc: eric.dumazet@...il.com, therbert@...gle.com, netdev@...r.kernel.org
Subject: Re: [PATCH v2] rps: fix insufficient bounds checking in
store_rps_dev_flow_table_cnt()
From: Xi Wang <xi.wang@...il.com>
Date: Thu, 22 Dec 2011 18:35:22 -0500
> Setting a large rps_flow_cnt like (1 << 30) on 32-bit platform will
> cause a kernel oops due to insufficient bounds checking.
>
> if (count > 1<<30) {
> /* Enforce a limit to prevent overflow */
> return -EINVAL;
> }
> count = roundup_pow_of_two(count);
> table = vmalloc(RPS_DEV_FLOW_TABLE_SIZE(count));
>
> Note that the macro RPS_DEV_FLOW_TABLE_SIZE(count) is defined as:
>
> ... + (count * sizeof(struct rps_dev_flow))
>
> where sizeof(struct rps_dev_flow) is 8. (1 << 30) * 8 will overflow
> 32 bits.
>
> This patch replaces the magic number (1 << 30) with a symbolic bound.
>
> Suggested-by: Eric Dumazet <eric.dumazet@...il.com>
> Signed-off-by: Xi Wang <xi.wang@...il.com>
Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists