netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] netfilter: netfilter fixes for 2.6.38
@ 2011-03-02 11:56 kaber
  2011-03-02 11:56 ` [PATCH 1/2] ipvs: fix dst_lock locking on dest update kaber
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: kaber @ 2011-03-02 11:56 UTC (permalink / raw)
  To: davem; +Cc: netfilter-devel, netdev

Hi Dave,

the following patches fix two IPVS/netfilter bugs:

- incorrect locking in __ip_vs_update_dest(), from Julian

- a potential oops when binding or unbinding an invalid address family
  through nfnetlink_log, from Jan

Please apply or pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6.git master

Thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] ipvs: fix dst_lock locking on dest update
  2011-03-02 11:56 [PATCH 0/2] netfilter: netfilter fixes for 2.6.38 kaber
@ 2011-03-02 11:56 ` kaber
  2011-03-02 11:56 ` [PATCH 2/2] netfilter: nf_log: avoid oops in (un)bind with invalid nfproto values kaber
  2011-03-02 19:29 ` [PATCH 0/2] netfilter: netfilter fixes for 2.6.38 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: kaber @ 2011-03-02 11:56 UTC (permalink / raw)
  To: davem; +Cc: netfilter-devel, netdev

From: Julian Anastasov <ja@ssi.bg>

	Fix dst_lock usage in __ip_vs_update_dest. We need
_bh locking because destination is updated in user context.
Can cause lockups on frequent destination updates.
Problem reported by Simon Kirby. Bug was introduced
in 2.6.37 from the "ipvs: changes for local real server"
change.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Hans Schillstrom <hans@schillstrom.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
 net/netfilter/ipvs/ip_vs_ctl.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 22f7ad5..ba98e13 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -808,9 +808,9 @@ __ip_vs_update_dest(struct ip_vs_service *svc, struct ip_vs_dest *dest,
 	dest->u_threshold = udest->u_threshold;
 	dest->l_threshold = udest->l_threshold;
 
-	spin_lock(&dest->dst_lock);
+	spin_lock_bh(&dest->dst_lock);
 	ip_vs_dst_reset(dest);
-	spin_unlock(&dest->dst_lock);
+	spin_unlock_bh(&dest->dst_lock);
 
 	if (add)
 		ip_vs_new_estimator(&dest->stats);
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] netfilter: nf_log: avoid oops in (un)bind with invalid nfproto values
  2011-03-02 11:56 [PATCH 0/2] netfilter: netfilter fixes for 2.6.38 kaber
  2011-03-02 11:56 ` [PATCH 1/2] ipvs: fix dst_lock locking on dest update kaber
@ 2011-03-02 11:56 ` kaber
  2011-03-02 19:29 ` [PATCH 0/2] netfilter: netfilter fixes for 2.6.38 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: kaber @ 2011-03-02 11:56 UTC (permalink / raw)
  To: davem; +Cc: netfilter-devel, netdev

From: Jan Engelhardt <jengelh@medozas.de>

Like many other places, we have to check that the array index is
within allowed limits, or otherwise, a kernel oops and other nastiness
can ensue when we access memory beyond the end of the array.

[ 5954.115381] BUG: unable to handle kernel paging request at 0000004000000000
[ 5954.120014] IP:  __find_logger+0x6f/0xa0
[ 5954.123979]  nf_log_bind_pf+0x2b/0x70
[ 5954.123979]  nfulnl_recv_config+0xc0/0x4a0 [nfnetlink_log]
[ 5954.123979]  nfnetlink_rcv_msg+0x12c/0x1b0 [nfnetlink]
...

The problem goes back to v2.6.30-rc1~1372~1342~31 where nf_log_bind
was decoupled from nf_log_register.

Reported-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>,
  via irc.freenode.net/#netfilter
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
 net/netfilter/nf_log.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
index b07393e..9181699 100644
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@ -85,6 +85,8 @@ EXPORT_SYMBOL(nf_log_unregister);
 
 int nf_log_bind_pf(u_int8_t pf, const struct nf_logger *logger)
 {
+	if (pf >= ARRAY_SIZE(nf_loggers))
+		return -EINVAL;
 	mutex_lock(&nf_log_mutex);
 	if (__find_logger(pf, logger->name) == NULL) {
 		mutex_unlock(&nf_log_mutex);
@@ -98,6 +100,8 @@ EXPORT_SYMBOL(nf_log_bind_pf);
 
 void nf_log_unbind_pf(u_int8_t pf)
 {
+	if (pf >= ARRAY_SIZE(nf_loggers))
+		return;
 	mutex_lock(&nf_log_mutex);
 	rcu_assign_pointer(nf_loggers[pf], NULL);
 	mutex_unlock(&nf_log_mutex);
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] netfilter: netfilter fixes for 2.6.38
  2011-03-02 11:56 [PATCH 0/2] netfilter: netfilter fixes for 2.6.38 kaber
  2011-03-02 11:56 ` [PATCH 1/2] ipvs: fix dst_lock locking on dest update kaber
  2011-03-02 11:56 ` [PATCH 2/2] netfilter: nf_log: avoid oops in (un)bind with invalid nfproto values kaber
@ 2011-03-02 19:29 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2011-03-02 19:29 UTC (permalink / raw)
  To: kaber; +Cc: netfilter-devel, netdev

From: kaber@trash.net
Date: Wed,  2 Mar 2011 12:56:19 +0100

> the following patches fix two IPVS/netfilter bugs:
> 
> - incorrect locking in __ip_vs_update_dest(), from Julian
> 
> - a potential oops when binding or unbinding an invalid address family
>   through nfnetlink_log, from Jan
> 
> Please apply or pull from:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6.git master

Pulled, thanks a lot Patrick.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-03-02 19:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-02 11:56 [PATCH 0/2] netfilter: netfilter fixes for 2.6.38 kaber
2011-03-02 11:56 ` [PATCH 1/2] ipvs: fix dst_lock locking on dest update kaber
2011-03-02 11:56 ` [PATCH 2/2] netfilter: nf_log: avoid oops in (un)bind with invalid nfproto values kaber
2011-03-02 19:29 ` [PATCH 0/2] netfilter: netfilter fixes for 2.6.38 David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).