All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] GFS2: Move most of the remaining inode.c into ops_inode.c
Date: Sat, 24 Jan 2015 22:45:03 +0300	[thread overview]
Message-ID: <20150124194503.GA22383@mwanda> (raw)

Hello Steven Whitehouse,

The [some really old patch], leads to the following static checker
warning:

	fs/gfs2/inode.c:203 gfs2_inode_lookup()
	error: passing non negative 13 to ERR_PTR

fs/gfs2/inode.c
   167                  set_bit(GIF_INVALID, &ip->i_flags);
   168                  error = gfs2_glock_nq_init(io_gl, LM_ST_SHARED, GL_EXACT, &ip->i_iopen_gh);
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
It looks like this function can return GLR_TRYFAILED.  The caller is
only expecting normal ERR_PTRs so it could cause an oops.

   169                  if (unlikely(error))
   170                          goto fail_iopen;
   171  
   172                  ip->i_iopen_gh.gh_gl->gl_object = ip;
   173                  gfs2_glock_put(io_gl);
   174                  io_gl = NULL;
   175  
   176                  if (type == DT_UNKNOWN) {
   177                          /* Inode glock must be locked already */
   178                          error = gfs2_inode_refresh(GFS2_I(inode));
   179                          if (error)
   180                                  goto fail_refresh;
   181                  } else {
   182                          inode->i_mode = DT2IF(type);
   183                  }
   184  
   185                  gfs2_set_iop(inode);
   186                  unlock_new_inode(inode);
   187          }
   188  
   189          return inode;
   190  
   191  fail_refresh:
   192          ip->i_iopen_gh.gh_flags |= GL_NOCACHE;
   193          ip->i_iopen_gh.gh_gl->gl_object = NULL;
   194          gfs2_glock_dq_uninit(&ip->i_iopen_gh);
   195  fail_iopen:
   196          if (io_gl)
   197                  gfs2_glock_put(io_gl);
   198  fail_put:
   199          ip->i_gl->gl_object = NULL;
   200          gfs2_glock_put(ip->i_gl);
   201  fail:
   202          iget_failed(inode);
   203          return ERR_PTR(error);
   204  }

Related:
fs/gfs2/inode.c:203 gfs2_inode_lookup() error: passing non negative 13 to ERR_PTR
fs/gfs2/inode.c:218 gfs2_lookup_by_inum() error: passing non negative 13 to ERR_PTR
fs/gfs2/inode.c:243 gfs2_lookup_by_inum() error: passing non negative 13 to ERR_PTR
fs/gfs2/inode.c:306 gfs2_lookupi() error: passing non negative 13 to ERR_PTR
fs/gfs2/inode.c:324 gfs2_lookupi() error: passing non negative 13 to ERR_PTR
fs/gfs2/inode.c:852 __gfs2_lookup() error: passing non negative 13 to ERR_PTR
fs/gfs2/inode.c:1567 gfs2_follow_link() error: passing non negative 13 to ERR_PTR

regards,
dan carpenter



             reply	other threads:[~2015-01-24 19:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-24 19:45 Dan Carpenter [this message]
2015-01-24 20:19 ` [Cluster-devel] GFS2: Move most of the remaining inode.c into ops_inode.c Steven Whitehouse
2015-01-26  7:57   ` Dan Carpenter

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=20150124194503.GA22383@mwanda \
    --to=dan.carpenter@oracle.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 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.