All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] ocfs2: don't evaluate buffer head to NULL managed by caller
Date: Thu, 29 Mar 2018 14:45:23 -0700	[thread overview]
Message-ID: <20180329144523.91722a7b35c8ad17d3f1375e@linux-foundation.org> (raw)
In-Reply-To: <1522289162-31693-1-git-send-email-ge.changwei@h3c.com>

On Thu, 29 Mar 2018 10:06:02 +0800 Changwei Ge <ge.changwei@h3c.com> wrote:

> ocfs2_read_blocks() is used to read several blocks from disk.
> Currently, the input argument *bhs* can be NULL or NOT. It depends on
> the caller's behavior. If the function fails in reading blocks from
> disk, the corresponding bh will be assigned to NULL and put.
> 
> Obviously, above process for non-NULL input bh is not appropriate.
> Because the caller doesn't even know its bhs are put and re-assigned.
> 
> If buffer head is managed by caller, ocfs2_read_blocks should not
> evaluate it to NULL. It will cause caller accessing illegal memory,
> thus crash.

(What about ocfs2_read_blocks_sync()?)

Passing non-NULL entries in bhs[] looks like a weird thing to do.  Do
any callers actually do this?  And of they do, do they actually care
about the alteration of bhs[] if the call failed?

  parent reply	other threads:[~2018-03-29 21:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-29  2:06 [Ocfs2-devel] [PATCH] ocfs2: don't evaluate buffer head to NULL managed by caller Changwei Ge
2018-03-29  2:35 ` Gang He
2018-03-29  3:01   ` Changwei Ge
2018-03-29  3:21     ` Gang He
2018-03-29  6:25       ` Changwei Ge
2018-03-29  3:36 ` Larry Chen
2018-03-29  6:27   ` Changwei Ge
2018-03-29  9:50 ` piaojun
2018-03-29 10:32   ` Larry Chen
2018-03-29 12:04     ` Changwei Ge
2018-03-29 12:03   ` Changwei Ge
2018-03-29 21:45 ` Andrew Morton [this message]
2018-03-30  0:50   ` Changwei Ge
2018-03-30  0:50     ` [Ocfs2-devel] " Changwei Ge
2018-03-30  1:26 ` Joseph Qi
2018-03-30  1:31   ` Changwei Ge
2018-03-30  2:03     ` Joseph Qi
2018-03-30  2:17       ` Changwei Ge
2018-03-30  2:37         ` Joseph Qi
2018-03-31  2:06           ` Changwei Ge
2018-03-30  2:16   ` piaojun

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=20180329144523.91722a7b35c8ad17d3f1375e@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=ocfs2-devel@oss.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.