mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
To: Ilija Hadzic <ilijahadzic@gmail.com>
Cc: Shuah Khan <shuah.khan@hp.com>,
	Greg KH <gregkh@linuxfoundation.org>,
	jglisse@redhat.com, dri-devel@lists.freedesktop.org,
	LKML <linux-kernel@vger.kernel.org>,
	"Deucher, Alexander" <alexander.deucher@amd.com>,
	shuahkhan@gmail.com, airlied@redhat.com
Subject: Re: [PATCH] drm/radeon: fix NULL pointer dereference in UMS mode in radeon_cs_parser_fini()
Date: Wed, 23 Jan 2013 15:40:47 -0200	[thread overview]
Message-ID: <20130123174046.GD15627@herton-Z68MA-D2H-B3> (raw)
In-Reply-To: <CA+4h6Hno5o=RjrXhqupedEZXoHv6v_4duZtpHXV9F04t=x00Nw@mail.gmail.com>

On Wed, Jan 23, 2013 at 12:21:29PM -0500, Ilija Hadzic wrote:
> On Wed, Jan 23, 2013 at 11:07 AM, Herton Ronaldo Krzesinski
> <herton.krzesinski@canonical.com> wrote:
> > On Thu, Jan 17, 2013 at 10:09:42AM -0700, Shuah Khan wrote:
> >> On Wed, 2013-01-16 at 21:06 -0600, Ilija Hadzic wrote:
> >> > Actually, the code path affected by your patch is not executed in UMS mode
> >> > at all. Notice that radeon_cs_parser_fini is only called from
> >> > radeon_cs_ioctl which is a KMS-only ioctl (see radeon_kms.c).
> >> >
> >> > The equivalent of the fix you are trying to do is in
> >> > a6b7e1a02b77ab8fe8775d20a88c53d8ba55482e (function patched by that one is
> >> > the one used by legacy-CS ioctl), which you should go together
> >> > with ff4bd0827764e10a428a9d39e6814c5478863f94 if you are backporting UMS
> >> > fixes to 3.7. Both are needed to prevent kernel crashes in UMS mode.
> >> >
> >> > -- Ilija
> >>
> >> Thanks. I will take a look at a6b7e1a02b77ab8fe8775d20a88c53d8ba55482e.
> >> I sent back-ported ff4bd0827764e10a428a9d39e6814c5478863f94 patch to
> >> stable and I will back-port and send
> >> a6b7e1a02b77ab8fe8775d20a88c53d8ba55482e as well.
> >
> > While at it, also looks like commit
> > 25d8999780f8c1f53928f4a24a09c01550423109 could also be added to stables.
> > But while looking at it, while the patch itself is correct, I noted that
> > there is a possibility of double free: if either of the
> > p->chunks[p->chunk_ib_idx].kpage[] items are non NULL, we will free it in
> > radeon_cs_parser_init and also when calling one of the fini functions
> > (radeon_cs_parser_fini or r600_cs_parser_fini). So either we need to set
> > kpage[n] to NULL after kfree, or just return the error.
> >
> 
> Yes you are right. The error-handling path should force both kpage[]
> pointers to NULL before returning -ENOMEM. That would fix the double
> free.
> 
> Regarding, inclusion of 25d8999780f8c1f53928f4a24a09c01550423109 into
> stable (and possible follow-up patch to fix potential double-kfree),
> does this pass the "no fixes for theoretical problems in stable"
> criterion ?
> 
> It is an obvious bug, but it happens so rarely that I am not surprised
> that it has never happened: You need an (old) AGP card *and* you need
> to run out of kmalloc memory.

About the "theoretical problem" criteria, I think it applies more to
race conditions not detected in practice, things that are not obvious/
deterministic etc., but indeed commit 25d89997 looks not be worth to be
added on stables.

> 
> -- Ilija
> 

-- 
[]'s
Herton

      reply	other threads:[~2013-01-23 17:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-16 23:43 Shuah Khan
2013-01-17  3:06 ` Ilija Hadzic
2013-01-17 17:09   ` Shuah Khan
2013-01-23 16:07     ` Herton Ronaldo Krzesinski
2013-01-23 17:21       ` Ilija Hadzic
2013-01-23 17:40         ` Herton Ronaldo Krzesinski [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=20130123174046.GD15627@herton-Z68MA-D2H-B3 \
    --to=herton.krzesinski@canonical.com \
    --cc=airlied@redhat.com \
    --cc=alexander.deucher@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilijahadzic@gmail.com \
    --cc=jglisse@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shuah.khan@hp.com \
    --cc=shuahkhan@gmail.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

all inboxes | Powered by JetHome®