mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Neil Brown <neilb@suse.de>
To: "Satyam Sharma" <satyam.sharma@gmail.com>
Cc: "David CHANIAL" <david.ml@euro-web.fr>,
	"Linux Kernel Mailinglist" <linux-kernel@vger.kernel.org>
Subject: Re: BUG: unable to handle kernel NULL pointer dereference - nfs v3
Date: Fri, 20 Jul 2007 16:41:33 +1000	[thread overview]
Message-ID: <18080.22813.143226.671265@notabene.brown> (raw)
In-Reply-To: message from Satyam Sharma on Thursday July 19

On Thursday July 19, satyam.sharma@gmail.com wrote:
> Ugh, not a good day for me today ... my earlier conclusion was right,
> but not the reasoning behind it ... hopefully this time I'll do better :-)


Looks good.  Thanks for your helpful analysis.

> 
> 0x34 bytes is the offset of ex_uuid in struct fh_export.
> %ecx == 0, which means ex_uuid was NULL.

Yup. That shouldn't happen, but I can see that it is possible.

There was another case were ex_uuid could conceivably be referenced
while NULL that I fixed a little while ago.  Looks like I need to fix
this one too.  Something like the following.

Thanks,
NeilBrown

Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./fs/nfsd/nfsfh.c |   20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff .prev/fs/nfsd/nfsfh.c ./fs/nfsd/nfsfh.c
--- .prev/fs/nfsd/nfsfh.c	2007-07-13 17:41:48.000000000 +1000
+++ ./fs/nfsd/nfsfh.c	2007-07-20 12:53:36.000000000 +1000
@@ -566,13 +566,23 @@ enum fsid_source fsid_source(struct svc_
 	case FSID_DEV:
 	case FSID_ENCODE_DEV:
 	case FSID_MAJOR_MINOR:
-		return FSIDSOURCE_DEV;
+		if (fhp->fh_export->ex_dentry->d_inode->i_sb->s_type->fs_flags
+		    & FS_REQUIRES_DEV)
+			return FSIDSOURCE_DEV;
+		break;
 	case FSID_NUM:
-		return FSIDSOURCE_FSID;
-	default:
 		if (fhp->fh_export->ex_flags & NFSEXP_FSID)
 			return FSIDSOURCE_FSID;
-		else
-			return FSIDSOURCE_UUID;
+		break;
+	default:
+		break;
 	}
+	/* either a UUID type filehandle, or the filehandle doesn't
+	 * match the export.
+	 */
+	if (fhp->fh_export->ex_flags & NFSEXP_FSID)
+		return FSIDSOURCE_FSID;
+	if (fhp->fh_export->ex_uuid)
+		return FSIDSOURCE_UUID;
+	return FSIDSOURCE_DEV;
 }

  reply	other threads:[~2007-07-20  6:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-16  4:38 David CHANIAL
2007-07-17 11:13 ` Neil Brown
2007-07-17 13:11   ` David CHANIAL
2007-07-19 14:11   ` Satyam Sharma
2007-07-19 15:11     ` Satyam Sharma
2007-07-20  6:41       ` Neil Brown [this message]
2007-07-20  7:13         ` Satyam Sharma
2007-07-20 13:33           ` David CHANIAL
2007-07-20 13:36             ` Satyam Sharma
2007-07-27  7:28               ` David CHANIAL
2007-09-03 23:55                 ` Satyam Sharma
2007-09-04  7:14                   ` David CHANIAL

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=18080.22813.143226.671265@notabene.brown \
    --to=neilb@suse.de \
    --cc=david.ml@euro-web.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=satyam.sharma@gmail.com \
    /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

all inboxes | Powered by JetHome®