From: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
Date: Fri, 10 Nov 2006 17:15:21 -0800 (PST)
> Based on implementation by Rick Payne.
>
> Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
In the tcp_get_md5sig_pool sequences, if NULL is returned
the get_cpu() will leak.
+static inline
+struct tcp_md5sig_pool *tcp_get_md5sig_pool(void)
+{
+ return __tcp_get_md5sig_pool(get_cpu());
+}
This unconditionally does get_cpu().
+struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu)
+{
+ struct tcp_md5sig_pool **p;
+ spin_lock(&tcp_md5sig_pool_lock);
+ p = tcp_md5sig_pool;
+ if (p)
+ tcp_md5sig_users++;
+ spin_unlock(&tcp_md5sig_pool_lock);
+ return (p ? *per_cpu_ptr(p, cpu) : NULL);
+}
This will not do a put_cpu() if it returns NULL.
+ hp = tcp_get_md5sig_pool();
+ if (!hp)
+ goto clear_hash_noput;
And call sites like above do not do the put_cpu() either.
Probably the cleanest fix is to do something like this:
+static inline
+struct tcp_md5sig_pool *tcp_get_md5sig_pool(void)
+{
+ int cpu = get_cpu();
+ struct tcp_md5sig_pool *ret = __tcp_get_md5sig_pool(cpu);
+ if (!ret)
+ put_cpu();
+ return ret;
+}
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html