diff mbox

netfilter: nf_log fix

Message ID 49E4FB0C.1080103@cosmosbay.com
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Dumazet April 14, 2009, 9:07 p.m. UTC
Eric Leblond a écrit :
> Hi,
> 
> Le mardi 14 avril 2009 à 22:14 +0200, Eric Dumazet a écrit :
>> Mariusz Kozlowski a écrit :
>>> On Tue, 14 Apr 2009 14:16:37 +0200
>>> Patrick McHardy <kaber@trash.net> wrote:
>>>
>>>> Eric Dumazet wrote:
>>>>> Patrick McHardy a écrit :
>>>>>> Mariusz Kozlowski wrote:
>>>>>>>     netfilter: nf_conntrack: use SLAB_DESTROY_BY_RCU and get rid of
>>>>>>> call_rcu()
>>>>>> Thanks for the report. Does this patch fix it?
>>>>>>
>>>>> Hi Patrick, sorry for the delay, I was in holidays.
>>>> No problem, me too :)
>>>>
> ...
> 
>> Check commit ca735b3aaa945626ba65a3e51145bfe4ecd9e222
>>
>> netfilter: use a linked list of loggers
> 
> ...
> 
>> Signed-off-by: Eric Leblond <eric@inl.fr>
>> Signed-off-by: Patrick McHardy <kaber@trash.net>
>>
>> It seems "struct list_head        list[NFPROTO_NUMPROTO];" is not initialized in "struct nf_logger" ?
>>
>> Please try following patch ?
> 
> I've just tested your patch. Without it, I was able to trigger the bug
> (modprobe ebt_ulog ; rmmod ebt_ulog). All run cleanly with it.
> 

OK thanks everybody, I submit it more formally then, using ARRAY_SIZE() macro too :)

[PATCH] netfilter: nf_log fix

commit ca735b3aaa945626ba65a3e51145bfe4ecd9e222
'netfilter: use a linked list of loggers'
introduced an array of list_head in "struct nf_logger", but
forgot to initialize it in nf_log_register(). This resulted
in oops when calling nf_log_unregister() at module unload time.

Reported-and-tested-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Acked-by: Eric Leblond <eric@inl.fr>


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Patrick McHardy April 15, 2009, 10:20 a.m. UTC | #1
Eric Dumazet wrote:
> OK thanks everybody, I submit it more formally then, using ARRAY_SIZE() macro too :)
> 
> [PATCH] netfilter: nf_log fix
> 
> commit ca735b3aaa945626ba65a3e51145bfe4ecd9e222
> 'netfilter: use a linked list of loggers'
> introduced an array of list_head in "struct nf_logger", but
> forgot to initialize it in nf_log_register(). This resulted
> in oops when calling nf_log_unregister() at module unload time.
> 
> Reported-and-tested-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
> Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
> Acked-by: Eric Leblond <eric@inl.fr>

Applied, thanks everyone.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
index 8bb998f..d8b85ab 100644
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@ -36,10 +36,14 @@  static struct nf_logger *__find_logger(int pf, const char *str_logger)
 int nf_log_register(u_int8_t pf, struct nf_logger *logger)
 {
 	const struct nf_logger *llog;
+	int i;
 
 	if (pf >= ARRAY_SIZE(nf_loggers))
 		return -EINVAL;
 
+	for (i = 0; i < ARRAY_SIZE(logger->list); i++)
+		INIT_LIST_HEAD(&logger->list[i]);
+
 	mutex_lock(&nf_log_mutex);
 
 	if (pf == NFPROTO_UNSPEC) {