From: Alex Deucher <alexdeucher@gmail.com>
To: Tim Gardner <tim.gardner@canonical.com>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 3.7-rc8] drm: Fix possible EDID memory allocation oops
Date: Thu, 6 Dec 2012 10:41:06 -0500 [thread overview]
Message-ID: <CADnq5_PBhkw9aOcobnhupKD79YbXoBSvczTgTf3Jz+Nom3aG7w@mail.gmail.com> (raw)
In-Reply-To: <1354734003-92714-1-git-send-email-tim.gardner@canonical.com>
On Wed, Dec 5, 2012 at 2:00 PM, Tim Gardner <tim.gardner@canonical.com> wrote:
> The result of drm_property_create_blob() is not checked for success
> which could lead to a NULL pointer dereference.
>
> I was led to this by a smatch warning:
>
> drivers/gpu/drm/drm_crtc.c:3186 drm_mode_connector_update_edid_property() error: potential null dereference 'connector->edid_blob_ptr'. (drm_property_create_blob returns null)
>
> drm_property_create_blob() calls kzalloc() which can return NULL.
>
> Cc: David Airlie <airlied@linux.ie>
> Cc: dri-devel@lists.freedesktop.org
> Cc: stable@vger.kernel.org # 3.0+
> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>
> This bug actually exists in the original commit f453ba0460742ad027ae0c4c7d61e62817b3e7ef
> (2.6.29), but I only checked as far back as 3.0 for stable.
>
> drivers/gpu/drm/drm_crtc.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index ef1b221..31872ba 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -3180,6 +3180,10 @@ int drm_mode_connector_update_edid_property(struct drm_connector *connector,
> size = EDID_LENGTH * (1 + edid->extensions);
> connector->edid_blob_ptr = drm_property_create_blob(connector->dev,
> size, edid);
> + if (!connector->edid_blob_ptr) {
> + pr_err("drm: Could not allocate %d edid blob bytes.\n", size);
> + return -ENOMEM;
> + }
>
> ret = drm_connector_property_set_value(connector,
> dev->mode_config.edid_property,
> --
> 1.7.9.5
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
prev parent reply other threads:[~2012-12-06 15:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-05 19:00 [PATCH 3.7-rc8] drm: Fix possible EDID memory allocation oops Tim Gardner
2012-12-06 15:41 ` Alex Deucher [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=CADnq5_PBhkw9aOcobnhupKD79YbXoBSvczTgTf3Jz+Nom3aG7w@mail.gmail.com \
--to=alexdeucher@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tim.gardner@canonical.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).