All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Epler <jepler@unpythonic.net>
To: Sanidhya Kashyap <sanidhya.gatech@gmail.com>
Cc: dhowells@redhat.com, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, taesoo@gatech.edu,
	changwoo@gatech.edu, sanidhya@gatech.edu, blee@gatech.edu
Subject: Re: [PATCH] afs: kstrdup() memory handling
Date: Sat, 21 Mar 2015 16:02:51 -0500	[thread overview]
Message-ID: <20150321210245.GB17049@unpythonic.net> (raw)
In-Reply-To: <1426958039-20266-1-git-send-email-sanidhya.gatech@gmail.com>

On Sat, Mar 21, 2015 at 01:13:59PM -0400, Sanidhya Kashyap wrote:
> Handling kstrdup() failure in case of memory pressure even
> for new_opts.
> 
> Signed-off-by: Sanidhya Kashyap <sanidhya.gatech@gmail.com>

Reviewed-by: Jeff Epler <jepler@unpythonic.net>

> ---
>  fs/afs/super.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/afs/super.c b/fs/afs/super.c
> index c486155..477f38e 100644
> --- a/fs/afs/super.c
> +++ b/fs/afs/super.c
> @@ -360,10 +360,13 @@ static struct dentry *afs_mount(struct file_system_type *fs_type,
>  	struct key *key;
>  	char *new_opts = kstrdup(options, GFP_KERNEL);
>  	struct afs_super_info *as;
> -	int ret;
> +	int ret = -ENOMEM;
>  
>  	_enter(",,%s,%p", dev_name, options);
>  
> +	if (!new_opts)
> +		goto error_out;
> +
>  	memset(&params, 0, sizeof(params));
>  
>  	ret = -EINVAL;
> @@ -441,6 +444,7 @@ error:
>  	afs_put_cell(params.cell);
>  	key_put(params.key);
>  	kfree(new_opts);
> +error_out:
>  	_leave(" = %d", ret);
>  	return ERR_PTR(ret);
>  }
> -- 
> 2.1.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

      reply	other threads:[~2015-03-21 21:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-21 16:50 [PATCH] afs: kstrdup() memory handling Sanidhya Kashyap
2015-03-21 17:07 ` Jeff Epler
2015-03-21 17:11   ` Sanidhya Kashyap
2015-03-21 17:13 ` Sanidhya Kashyap
2015-03-21 21:02   ` Jeff Epler [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=20150321210245.GB17049@unpythonic.net \
    --to=jepler@unpythonic.net \
    --cc=blee@gatech.edu \
    --cc=changwoo@gatech.edu \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sanidhya.gatech@gmail.com \
    --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 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.