mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Changwoo Min <changwoo.m@gmail.com>
Cc: jack@suse.cz, linux-kernel@vger.kernel.org, taesoo@gatech.edu,
	changwoo@gatech.edu, sanidhya@gatech.edu, blee@gatech.edu,
	csong84@gatech.edu
Subject: Re: [PATCH] udf: NULL dereference at udf_symlink() on error
Date: Wed, 1 Apr 2015 12:55:46 +0200	[thread overview]
Message-ID: <20150401105546.GH26339@quack.suse.cz> (raw)
In-Reply-To: <1427091109-1642-1-git-send-email-changwoo.m@gmail.com>

On Mon 23-03-15 02:11:49, Changwoo Min wrote:
> There is no check for udf_tgetblk(), which could return NULL, in udf_symlink(). 
> So there is a possibility of returning NULL under heavy memory pressure and 
> possibility of NULL dereference. 
> 
> Signed-off-by: Changwoo Min <changwoo.m@gmail.com>
> ---
>  fs/udf/namei.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/fs/udf/namei.c b/fs/udf/namei.c
> index 33b246b..ed2f221 100644
> --- a/fs/udf/namei.c
> +++ b/fs/udf/namei.c
> @@ -902,6 +902,10 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry,
>  				iinfo->i_location.partitionReferenceNum,
>  				0);
>  		epos.bh = udf_tgetblk(sb, block);
> +		if (!epos.bh) {
> +			err = -ENOMEM;
  This should be -EIO as per our discussion at the previous patch.
Otherwise I agree.

								Honza

> +			goto out_no_entry;
> +		}
>  		lock_buffer(epos.bh);
>  		memset(epos.bh->b_data, 0x00, bsize);
>  		set_buffer_uptodate(epos.bh);
> -- 
> 1.9.1
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

      reply	other threads:[~2015-04-01 10:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-23  6:11 Changwoo Min
2015-04-01 10:55 ` Jan Kara [this message]

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=20150401105546.GH26339@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=blee@gatech.edu \
    --cc=changwoo.m@gmail.com \
    --cc=changwoo@gatech.edu \
    --cc=csong84@gatech.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sanidhya@gatech.edu \
    --cc=taesoo@gatech.edu \
    /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®