LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: "Parag Warudkar" <parag.warudkar@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	"Ingo Molnar" <mingo@elte.hu>,
	"Thomas Gleixner" <tglx@linutronix.de>
Subject: Re: [PATCH] dmi: Prevent linked list corruption (resent)
Date: Mon, 11 Feb 2008 18:53:52 +0100	[thread overview]
Message-ID: <20080211185352.3e22ac6b@hyperion.delvare> (raw)
In-Reply-To: <82e4877d0802110935v11e4bdf8l783a9834ca0a950d@mail.gmail.com>

Hi Parag,

On Mon, 11 Feb 2008 12:35:39 -0500, Parag Warudkar wrote:
> On Feb 11, 2008 12:24 PM, Jean Delvare <khali@linux-fr.org> wrote:
> > [Once more without forgetting the last "quilt refresh", sorry.]
> >
> > Adding the same item to a given linked list more than once is guaranteed
> > to break and corrupt the list. This is however what we do in dmi_scan
> > since commit 79da4721117fcf188b4b007b775738a530f574da.
> >
> > Given that there is absolutely no interest in saving empty OEM
> > strings anyway, I propose the simple and efficient fix below: we
> > discard the empty OEM strings altogether.
> >
> > Signed-off-by: Jean Delvare <khali@linux-fr.org>
> > Cc: Parag Warudkar <parag.warudkar@gmail.com>
> > Cc: Ingo Molnar <mingo@elte.hu>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> 
> I suppose the list would be corrupted only if there are deletions from
> the list? (Which there aren't.)

As I understand the way doubly linked lists are implemented in Linux, I
think that the corruption exists even if you are only adding items to
the list. Each struct dmi_device contains a list_head which points to
the previous and next items in the list. If you add a struct dmi_device
that was already in the list, you are overwriting this list_head with
new pointers and you lose the pointers that were originally there. This
means that you have created a "shortcut" from one list item to another
item that is further in the list, and the items in-between them are no
longer reachable.

> Anyway not adding the empty strings is way better and I don't see now
> how they could've been useful.
> (I added them out of the doubt of breaking something.)
> 
> Acked-By: Parag Warudkar <parag.warudkar@gmail.com>

Thanks,
-- 
Jean Delvare

      reply	other threads:[~2008-02-11 17:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-11 17:22 [PATCH] dmi: Prevent linked list corruption Jean Delvare
2008-02-11 17:24 ` [PATCH] dmi: Prevent linked list corruption (resent) Jean Delvare
2008-02-11 17:35   ` Parag Warudkar
2008-02-11 17:53     ` Jean Delvare [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=20080211185352.3e22ac6b@hyperion.delvare \
    --to=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=parag.warudkar@gmail.com \
    --cc=tglx@linutronix.de \
    --subject='Re: [PATCH] dmi: Prevent linked list corruption (resent)' \
    /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

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).