linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: Sachin Bhamare <sbhamare@panasas.com>
Cc: Alexey Khoroshilov <khoroshilov@ispras.ru>,
	Benny Halevy <bhalevy@tonian.com>, <osd-dev@open-osd.org>,
	<linux-kernel@vger.kernel.org>, <ldv-project@ispras.ru>
Subject: Re: [PATCH] exofs: check for allocation failure in uri_store()
Date: Sun, 12 Aug 2012 21:57:28 +0300	[thread overview]
Message-ID: <5027FC98.2040903@panasas.com> (raw)
In-Reply-To: <5024075B.4090804@panasas.com>

On 08/09/2012 09:54 PM, Sachin Bhamare wrote:

> On 8/8/12 10:02 AM, Alexey Khoroshilov wrote:
>> There is no memory allocation failure check in uri_store().
>> That can lead to NULL pointer dereference.
>>
>> Found by Linux Driver Verification project (linuxtesting.org).
>>
>> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
>> ---
>>  fs/exofs/sys.c |    7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/exofs/sys.c b/fs/exofs/sys.c
>> index 5a7b691..1b4f2f9 100644
>> --- a/fs/exofs/sys.c
>> +++ b/fs/exofs/sys.c
>> @@ -80,8 +80,13 @@ static ssize_t uri_show(struct exofs_dev *edp, char *buf)
>>  
>>  static ssize_t uri_store(struct exofs_dev *edp, const char *buf, size_t len)
>>  {
>> +	uint8_t *new_uri;
>> +
>>  	edp->urilen = strlen(buf) + 1;
>> -	edp->uri = krealloc(edp->uri, edp->urilen, GFP_KERNEL);
>> +	new_uri = krealloc(edp->uri, edp->urilen, GFP_KERNEL);
>> +	if (new_uri == NULL)
>> +		return -ENOMEM;
>> +	edp->uri = new_uri;
>>  	strncpy(edp->uri, buf, edp->urilen);
>>  	return edp->urilen;
>>  }
> Ack-by : Sachin Bhamare <sbhamare@panasas.com>


Has been pushed to linux-next will be included in the next RCX
push to Linus.

Thanks
Boaz

      reply	other threads:[~2012-08-12 18:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-08 17:02 [PATCH] exofs: check for allocation failure in uri_store() Alexey Khoroshilov
2012-08-09 18:54 ` Sachin Bhamare
2012-08-12 18:57   ` Boaz Harrosh [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=5027FC98.2040903@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=bhalevy@tonian.com \
    --cc=khoroshilov@ispras.ru \
    --cc=ldv-project@ispras.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=osd-dev@open-osd.org \
    --cc=sbhamare@panasas.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).