Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 93c1af6c authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

net:rfs: adjust table size checking



Make sure root user does not try something stupid.

Also make sure mask field in struct rps_sock_flow_table
does not share a cache line with the potentially often dirtied
flow table.

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Fixes: 567e4b79 ("net: rfs: add hash collision detection")
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent acde2c2d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -653,7 +653,8 @@ struct rps_dev_flow_table {
 */
struct rps_sock_flow_table {
	u32	mask;
	u32	ents[0];

	u32	ents[0] ____cacheline_aligned_in_smp;
};
#define	RPS_SOCK_FLOW_TABLE_SIZE(_num) (offsetof(struct rps_sock_flow_table, ents[_num]))

+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ static int rps_sock_flow_sysctl(struct ctl_table *table, int write,

	if (write) {
		if (size) {
			if (size > 1<<30) {
			if (size > 1<<29) {
				/* Enforce limit to prevent overflow */
				mutex_unlock(&sock_flow_mutex);
				return -EINVAL;