mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jesper Juhl <jesper.juhl@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Jan Kara <jack@suse.cz>, Jesper Juhl <jesper.juhl@gmail.com>
Subject: [PATCH] fix potential null pointer deref in quota
Date: Sat, 18 Mar 2006 23:08:04 +0100	[thread overview]
Message-ID: <200603182308.05050.jesper.juhl@gmail.com> (raw)

The coverity checker noticed that we may pass a NULL super_block to
do_quotactl() that dereferences it.
Dereferencing NULL pointers is bad medicine, better check and fail 
gracefully.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---

 fs/quota.c |    3 +++
 1 files changed, 3 insertions(+)

--- linux-2.6.16-rc6-orig/fs/quota.c	2006-03-12 14:19:02.000000000 +0100
+++ linux-2.6.16-rc6/fs/quota.c	2006-03-18 23:03:32.000000000 +0100
@@ -231,6 +231,9 @@ static int do_quotactl(struct super_bloc
 {
 	int ret;
 
+	if (!sb)
+		return -ENODEV;
+
 	switch (cmd) {
 		case Q_QUOTAON: {
 			char *pathname;



             reply	other threads:[~2006-03-18 22:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-18 22:08 Jesper Juhl [this message]
2006-03-20  7:23 ` Andrew Morton
2006-03-20  8:01   ` Jesper Juhl
2006-03-20  9:46 ` Jan Kara
2006-03-26 12:44   ` Jesper Juhl

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=200603182308.05050.jesper.juhl@gmail.com \
    --to=jesper.juhl@gmail.com \
    --cc=jack@suse.cz \
    --cc=linux-kernel@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

Powered by JetHome