Re: GPF in i2cdev_release with i2c_tiny_usb

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On Sat, Nov 9, 2013 at 1:52 PM, Martin Vogt <mvogt1@xxxxxxxxx> wrote:
> No. I think the GPF only happens if an application has an open
> file descriptor.
> Just tested ~5 dis/reconnect USB without problem,
> started an application which opens i2c-7 USB disconnect->crash.

I have modified i2cdev_release in i2c-dev.c to:

static int i2cdev_release(struct inode *inode, struct file *file)
{
        struct i2c_client *client = file->private_data;
        pr_debug("i2c-dev: i2cdev_release -1:%p\n",client);
        pr_debug("i2c-dev: i2cdev_release -1a:%p\n",client->adapter);
        return 0;       // DO NOTHING

        i2c_put_adapter(client->adapter);
        pr_debug("i2c-dev: i2cdev_release -2\n");
        kfree(client);
        file->private_data = NULL;
        pr_debug("i2c-dev: i2cdev_release -3\n");
        return 0;
}

with this the kernel crash is gone.
Thus not calling i2c_put_adapter(client->adapter); helps.
Both pointers (client,client->adapter) are not NULL, but I cannot
say if they contain anything still valid.
But even doing the call to i2c_put_adapter and modifing it to:

void i2c_put_adapter(struct i2c_adapter *adap)
{
        pr_debug("i2c-dev: i2c_put_adapter:\n");
        //module_put(adap->owner);
}

crashes the kernel. which is strange because its a NOP.


Btw: if the crash occurs a reboot is not necessary.
For testing I have removed the i2c-dev module with:

rmmod -f i2c-dev

regards,

Martin
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux