netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@davemloft.net>
Cc: Netfilter Development Mailinglist
	<netfilter-devel@vger.kernel.org>,
	Linux Netdev List <netdev@vger.kernel.org>
Subject: netfilter 01/01: xt_quota: fix wrong return value (error case)
Date: Thu, 20 Aug 2009 14:47:34 +0200	[thread overview]
Message-ID: <4A8D45E6.6050800@trash.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 179 bytes --]

Hi Dave,

the following patch for 2.6.31 fixes a regression in the xt_quota module
introduced in 2.6.30-rc1, causing a crash when memory allocation fails.

Please apply, thanks.


[-- Attachment #2: 01.diff --]
[-- Type: text/x-patch, Size: 865 bytes --]

commit 53fa59e004cd02b1bd97edff965d063222bd0171
Author: Jan Engelhardt <jengelh@medozas.de>
Date:   Thu Aug 13 15:42:17 2009 +0200

    netfilter: xt_quota: fix wrong return value (error case)
    
    Success was indicated on a memory allocation failure, thereby causing
    a crash due to a later NULL deref.
    (Affects v2.6.30-rc1 up to here.)
    
    Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
    Signed-off-by: Patrick McHardy <kaber@trash.net>

diff --git a/net/netfilter/xt_quota.c b/net/netfilter/xt_quota.c
index 98fc190..390b7d0 100644
--- a/net/netfilter/xt_quota.c
+++ b/net/netfilter/xt_quota.c
@@ -52,7 +52,7 @@ static bool quota_mt_check(const struct xt_mtchk_param *par)
 
 	q->master = kmalloc(sizeof(*q->master), GFP_KERNEL);
 	if (q->master == NULL)
-		return -ENOMEM;
+		return false;
 
 	q->master->quota = q->quota;
 	return true;

                 reply	other threads:[~2009-08-20 12:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A8D45E6.6050800@trash.net \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).