From: Vladimir Motyka <vladimir.motyka@gmail.com>
To: Julia Lawall <julia@diku.dk>
Cc: cjb@laptop.org, kernel-janitors@vger.kernel.org,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers/mmc/card/block.c: fix potential null dereference 'idata'
Date: Mon, 09 May 2011 22:37:21 +0200 [thread overview]
Message-ID: <4DC85081.9090105@gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1105091811320.15483@pc-004.diku.dk>
On 05/09/2011 06:12 PM, Julia Lawall wrote:
> I guess there is also a point at which idata has been successfully
> allocated but idata->buf has not.
>
> julia
>
Yes there is. Thank You for pointing out.
Vladimir Motyka
> On Mon, 9 May 2011, Vladimir Motyka wrote:
>
>> When allocation of idata fails there was a null dereference.
>>
>> Signed-off-by: Vladimir Motyka <vladimir.motyka@gmail.com>
>> ---
>> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
>> index 407836d..a03cdc6 100644
>> --- a/drivers/mmc/card/block.c
>> +++ b/drivers/mmc/card/block.c
>> @@ -237,7 +237,7 @@ static struct mmc_blk_ioc_data
>> *mmc_blk_ioctl_copy_from_user(
>> idata = kzalloc(sizeof(*idata), GFP_KERNEL);
>> if (!idata) {
>> err = -ENOMEM;
>> - goto copy_err;
>> + goto alloc_err;
>> }
>>
>> if (copy_from_user(&idata->ic, user, sizeof(idata->ic))) {
>> @@ -268,8 +268,8 @@ static struct mmc_blk_ioc_data
>> *mmc_blk_ioctl_copy_from_user(
>> copy_err:
>> kfree(idata->buf);
>> kfree(idata);
>> +alloc_err:
>> return ERR_PTR(err);
>> -
>> }
>>
>> static int mmc_blk_ioctl_cmd(struct block_device *bdev,
>> --
>> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
next prev parent reply other threads:[~2011-05-09 20:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-09 14:05 [PATCH] drivers/mmc/card/block.c: fix potential null dereference 'idata' Vladimir Motyka
2011-05-09 14:32 ` Julia Lawall
2011-05-09 15:05 ` Vladimir Motyka
2011-05-09 15:13 ` Andy Shevchenko
2011-05-09 15:14 ` Julia Lawall
2011-05-09 16:08 ` Vladimir Motyka
2011-05-09 16:12 ` Julia Lawall
2011-05-09 20:37 ` Vladimir Motyka [this message]
2011-05-09 20:37 ` Vladimir Motyka
2011-05-11 4:03 ` Chris Ball
2011-05-10 7:47 ` Andy Shevchenko
2011-05-10 7:57 ` Julia Lawall
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=4DC85081.9090105@gmail.com \
--to=vladimir.motyka@gmail.com \
--cc=cjb@laptop.org \
--cc=julia@diku.dk \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.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).