Re: linux-next: manual merge of the driver-core tree with the net-next tree

From: Arend van Spriel
Date: Thu Dec 04 2014 - 06:41:29 EST


On 04-12-14 11:19, Jeremiah Mahler wrote:
> Arend,
>
> I haven't heard if you have looked at this bug at all yet. I was
> curious so I looked at it some more and I have some more information
> that might be helpful.
>
> On Wed, Dec 03, 2014 at 01:41:28PM -0800, Jeremiah Mahler wrote:
>> On Wed, Dec 03, 2014 at 01:06:59PM -0800, Jeremiah Mahler wrote:
>>> Arend,
>>>
> [...]
>>>>>
>>>>> I took a look at the patch that is causing this problem (d32394fae95).
>>>>> My config negates everything in the patch except for a one line change
>>>>> to ath9k/pci.c. If I remove this change (shown below) the problem goes
>>>>> away.
>>>>
>>>> Ok. But then it will likely crash when you cat one of the changed debugfs
>>>> files. Guess this commit needs to be reverted entirely.
>>>>
> [...]
>
> Referring to the code snippet below, notice that both pci_set_drvdata()
> and dev_set_drvdata() are called. If the call to dev_set_drvdata() is
> removed the bug goes away.
>
> drivers/net/wireless/ath/ath9k/pci.c
>
> 861 SET_IEEE80211_DEV(hw, &pdev->dev);
> 862 pci_set_drvdata(pdev, hw);
> 863
> 864 sc = hw->priv;
> 865 sc->hw = hw;
> 866 sc->dev = &pdev->dev;
> 867 dev_set_drvdata(sc->dev, sc);
> 868 sc->mem = pcim_iomap_table(pdev)[0];
> 869 sc->driver_data = id->driver_data;
>
> Translating the call to pci_set_drvdata() produces the following.
>
> pci_set_drvdata(pdev, hw);
> (translating from include/linux/pci.h)
> dev_set_drvdata(&pdev->dev, hw)
> (translating from include/linux/device.h)
> &pdev->dev->driver = hw;
>
> And doing the same for dev_set_drvdata().
>
> dev_set_drvdata(sc->dev, sc)
> (sc->dev = &pdev->dev)
> dev_set_drvdata(&pdev->dev, sc)
> (translating from include/linux/device.h)
> &pdev->dev->driver = sc;
>
> The same destination is being set with two different values. Then calls
> to pci_get_drvdata(), which expect hw, are getting sc, and it breaks.

Yes, that was my suspicion as well. This is why I asked to revert the
patch entirely. I see that sc equals hw->priv so I know how to correct
it. However, with merge window around the corner it may be easier to do
a revert.

Regards,
Arend
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/