From: Sachin Bhamare <sbhamare@panasas.com>
To: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: Boaz Harrosh <bharrosh@panasas.com>,
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: Thu, 9 Aug 2012 11:54:19 -0700 [thread overview]
Message-ID: <5024075B.4090804@panasas.com> (raw)
In-Reply-To: <1344445357-986-1-git-send-email-khoroshilov@ispras.ru>
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>
next prev parent reply other threads:[~2012-08-09 18:54 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 [this message]
2012-08-12 18:57 ` Boaz Harrosh
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=5024075B.4090804@panasas.com \
--to=sbhamare@panasas.com \
--cc=bhalevy@tonian.com \
--cc=bharrosh@panasas.com \
--cc=khoroshilov@ispras.ru \
--cc=ldv-project@ispras.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=osd-dev@open-osd.org \
/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).