Re: [PATCH 2.6.20] [TCP] MD5 Signature Option (RFC2385) support.
From: YOSHIFUJI Hideaki <[EMAIL PROTECTED]> Date: Tue, 14 Nov 2006 07:06:36 -0800 (PST) > Good point, I agree. > > Here's the updated and rebased patch. > > >From a3dea6a6b127b3d38932677c8da854b62a20540e Mon Sep 17 00:00:00 2001 > From: YOSHIFUJI Hideaki <[EMAIL PROTECTED]> > Date: Tue, 14 Nov 2006 09:57:39 +0900 > Subject: [PATCH] [TCP]: MD5 Signature Option (RFC2385) support. > > Based on implementation by Rick Payne. > > Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]> Looks great, patch applied, thanks a lot. - 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
Re: [PATCH 2.6.20] [TCP] MD5 Signature Option (RFC2385) support.
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