All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Sage Weil <sage@newdream.net>
Cc: ceph-devel@vger.kernel.org
Subject: potential null dereference in __dcache_readdir()
Date: Fri, 19 Nov 2010 14:52:20 +0300	[thread overview]
Message-ID: <20101119115220.GA2111@bicker> (raw)

Hi hi!

This is a smatch thing.  We check if last is NULL and then dereference
it later with out checking.  It might be worth looking at.  I'm not
familiar enough with the code to know the fix.

It comes from:
	commit 2817b000b02c5f0c05af67c01fb2684e1381d6ef
	Author: Sage Weil <sage@newdream.net>
	Date:   Tue Oct 6 11:31:08 2009 -0700

	    ceph: directory operations

regards,
dan carpenter

fs/ceph/dir.c +124 __dcache_readdir(28) error: we previously assumed 'last' could be null.
   116          /* start at beginning? */
   117          if (filp->f_pos == 2 || (last &&
                                         ^^^^
	checked here.

   118                                   filp->f_pos < ceph_dentry(last)->offset)) {
   119                  if (list_empty(&parent->d_subdirs))
   120                          goto out_unlock;
   121                  p = parent->d_subdirs.prev;
   122                  dout(" initial p %p/%p\n", p->prev, p->next);
   123          } else {
   124                  p = last->d_u.d_child.prev;
                            ^^^^^^^^^^^^^^^^^^^^^^
	dereferenced here.
   125          }


             reply	other threads:[~2010-11-19 11:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-19 11:52 Dan Carpenter [this message]
2010-11-23  7:21 ` potential null dereference in __dcache_readdir() Sage Weil

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=20101119115220.GA2111@bicker \
    --to=error27@gmail.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=sage@newdream.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.