From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: Sasha Levin <sasha.levin@oracle.com>, plagnioj@jcrosoft.com
Cc: gregkh@linuxfoundation.org, linux-fbdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] video: kyro: fix incorrect sizes when copying to userspace
Date: Tue, 26 Nov 2013 14:40:54 +0000 [thread overview]
Message-ID: <5294B2F6.5020006@ti.com> (raw)
In-Reply-To: <1384889136-15516-1-git-send-email-sasha.levin@oracle.com>
[-- Attachment #1: Type: text/plain, Size: 1475 bytes --]
On 2013-11-19 21:25, Sasha Levin wrote:
> kyro would copy u32s and specify sizeof(unsigned long) as the size to copy.
>
> This would copy more data than intended and cause memory corruption and might
> leak kernel memory.
>
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
> drivers/video/kyro/fbdev.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/video/kyro/fbdev.c b/drivers/video/kyro/fbdev.c
> index 50c8574..65041e1 100644
> --- a/drivers/video/kyro/fbdev.c
> +++ b/drivers/video/kyro/fbdev.c
> @@ -624,15 +624,15 @@ static int kyrofb_ioctl(struct fb_info *info,
> return -EINVAL;
> }
> case KYRO_IOCTL_UVSTRIDE:
> - if (copy_to_user(argp, &deviceInfo.ulOverlayUVStride, sizeof(unsigned long)))
> + if (copy_to_user(argp, &deviceInfo.ulOverlayUVStride, sizeof(deviceInfo.ulOverlayUVStride)))
> return -EFAULT;
> break;
> case KYRO_IOCTL_STRIDE:
> - if (copy_to_user(argp, &deviceInfo.ulOverlayStride, sizeof(unsigned long)))
> + if (copy_to_user(argp, &deviceInfo.ulOverlayStride, sizeof(deviceInfo.ulOverlayStride)))
> return -EFAULT;
> break;
> case KYRO_IOCTL_OVERLAY_OFFSET:
> - if (copy_to_user(argp, &deviceInfo.ulOverlayOffset, sizeof(unsigned long)))
> + if (copy_to_user(argp, &deviceInfo.ulOverlayOffset, sizeof(deviceInfo.ulOverlayOffset)))
> return -EFAULT;
> break;
> }
>
Thanks, applied for 3.13 fixes.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: Sasha Levin <sasha.levin@oracle.com>, <plagnioj@jcrosoft.com>
Cc: <gregkh@linuxfoundation.org>, <linux-fbdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] video: kyro: fix incorrect sizes when copying to userspace
Date: Tue, 26 Nov 2013 16:40:54 +0200 [thread overview]
Message-ID: <5294B2F6.5020006@ti.com> (raw)
In-Reply-To: <1384889136-15516-1-git-send-email-sasha.levin@oracle.com>
[-- Attachment #1: Type: text/plain, Size: 1475 bytes --]
On 2013-11-19 21:25, Sasha Levin wrote:
> kyro would copy u32s and specify sizeof(unsigned long) as the size to copy.
>
> This would copy more data than intended and cause memory corruption and might
> leak kernel memory.
>
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
> drivers/video/kyro/fbdev.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/video/kyro/fbdev.c b/drivers/video/kyro/fbdev.c
> index 50c8574..65041e1 100644
> --- a/drivers/video/kyro/fbdev.c
> +++ b/drivers/video/kyro/fbdev.c
> @@ -624,15 +624,15 @@ static int kyrofb_ioctl(struct fb_info *info,
> return -EINVAL;
> }
> case KYRO_IOCTL_UVSTRIDE:
> - if (copy_to_user(argp, &deviceInfo.ulOverlayUVStride, sizeof(unsigned long)))
> + if (copy_to_user(argp, &deviceInfo.ulOverlayUVStride, sizeof(deviceInfo.ulOverlayUVStride)))
> return -EFAULT;
> break;
> case KYRO_IOCTL_STRIDE:
> - if (copy_to_user(argp, &deviceInfo.ulOverlayStride, sizeof(unsigned long)))
> + if (copy_to_user(argp, &deviceInfo.ulOverlayStride, sizeof(deviceInfo.ulOverlayStride)))
> return -EFAULT;
> break;
> case KYRO_IOCTL_OVERLAY_OFFSET:
> - if (copy_to_user(argp, &deviceInfo.ulOverlayOffset, sizeof(unsigned long)))
> + if (copy_to_user(argp, &deviceInfo.ulOverlayOffset, sizeof(deviceInfo.ulOverlayOffset)))
> return -EFAULT;
> break;
> }
>
Thanks, applied for 3.13 fixes.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]
next prev parent reply other threads:[~2013-11-26 14:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-19 19:25 [PATCH] video: kyro: fix incorrect sizes when copying to userspace Sasha Levin
2013-11-19 19:25 ` Sasha Levin
2013-11-26 14:40 ` Tomi Valkeinen [this message]
2013-11-26 14:40 ` Tomi Valkeinen
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=5294B2F6.5020006@ti.com \
--to=tomi.valkeinen@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=plagnioj@jcrosoft.com \
--cc=sasha.levin@oracle.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 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.