mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dominik Brodowski <linux@dominikbrodowski.net>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: torvalds@osdl.org, linux-kernel@vger.kernel.org,
	linux-pcmcia@lists.infradead.org
Subject: Re: [PATCH] pcmcia: Fix broken abuse of dev->driver_data
Date: Mon, 22 Sep 2008 23:56:17 +0200	[thread overview]
Message-ID: <20080922215617.GA13057@comet.dominikbrodowski.net> (raw)
In-Reply-To: <20080922155814.2bdad40f@lxorguk.ukuu.org.uk>

Alan,

(CC: linux-pcmcia added)

Many thanks for finding this bug.

On Mon, Sep 22, 2008 at 03:58:14PM +0100, Alan Cox wrote:
> PCMCIA abuses dev->private_data in the probe methods. Unfortunately it
> continues to abuse it after calling drv->probe() which leads to crashes and
> other nasties (such as bogus probes of multifunction devices) giving errors like

Well, PCMCIA drivers have (struct pcmcia_device *) p_dev->priv available and
use this regularly, so using dev->private_data never has been supported.
Nonetheless, let's add support for using dev->private_data also for PCMCIA
devices and remove p_dev->priv eventually.

> As its close to the final release just move the hack so it works out,
> hopefully someone will be sufficiently embarrassed to produce a nice rework
> for 2.6.28.

Could you remove this from the changelog entry, please?


> @@ -426,6 +426,18 @@ static int pcmcia_device_probe(struct device * dev)
>  	p_dev = to_pcmcia_dev(dev);
>  	p_drv = to_pcmcia_drv(dev->driver);
>  	s = p_dev->socket;
> +	

trailing whitespace

> +	/* The PCMCIA code passes the match data in via dev->driver_data
> +	 * which is an ugly hack. Once the driver probe is called it may
> +	 * and often will overwrite the match data so we must save it first 

trailing whitespace

>  	if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) &&
>  	    (p_dev->socket->device_count == 1) && (p_dev->device_no ==
> 0)) pcmcia_add_device_later(p_dev->socket, 0);

uh?

>  
> - put_module:
> +put_module:
>  	if (ret)
>  		module_put(p_drv->owner);
> - put_dev:
> +put_dev:

unrelated -- please do not change it this time.

Best and thanks again,

	Dominik

  reply	other threads:[~2008-09-22 21:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-22 14:58 Alan Cox
2008-09-22 21:56 ` Dominik Brodowski [this message]
2008-09-22 22:12   ` Alan Cox
2008-09-22 22:26     ` Dominik Brodowski
2008-09-22 23:15       ` Alan Cox
2008-09-23  1:31         ` Komuro
2008-09-26 13:29         ` [PATCH git latest] drivers/net: fixing a datarace related to update_stats() Komuro
2008-09-26 16:06           ` Tammy
2008-09-26 17:31           ` Lin Tan
2008-11-01  2:07       ` [BUG REPORT!!!] [PATCH 19/49] pcmcia: remove remaining in-kernel pcmcia_get_configuration_info() users Komuro
2008-11-02  8:46         ` Komuro
2008-11-02  9:17           ` Dominik Brodowski
2008-11-02 10:33             ` Komuro
2008-11-02 12:04               ` Dominik Brodowski
2008-10-06 12:18     ` [PATCH 03/19] pcmcia: Whine harder about use of EXCLUSIVE Komuro

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=20080922215617.GA13057@comet.dominikbrodowski.net \
    --to=linux@dominikbrodowski.net \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pcmcia@lists.infradead.org \
    --cc=torvalds@osdl.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

all inboxes | Powered by JetHome®