[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20130209070558.4322.qmail@science.horizon.com>
Date: 9 Feb 2013 02:05:58 -0500
From: "George Spelvin" <linux@...izon.com>
To: gregkh@...uxfoundation.org, linux@...izon.com
Cc: giometti@...ux.it, linux-kernel@...r.kernel.org,
linux-serial@...r.kernel.org, peter@...leysoftware.com
Subject: Re: [PATCH 0/7] 3.8-rc regression with pps-ldisc due to 70ece7a731
As a followup, testing my fixes has revealed an old bug in the
PPS driver that I'm trying to figure out how to solve.
Basically, pps_unregister_cdev does
device_destroy(pps_class, pps->dev->devt);
cdev_del(&pps->cdev);
And device_destroy ends up calling pps->dev->release,
which is pps_device_destruct, which does
mutex_lock(&pps_idr_lock);
idr_remove(&pps_idr, pps->id);
mutex_unlock(&pps_idr_lock);
kfree(dev);
kfree(pps);
Now the problem is that the kfree(pps) happens *before* the
cdev_del(&pps->cdev) call, which is Not Good.
I'm trying to figure out The Right Thing to do in this case and include a
fix for that, too. It's not a regression, but it is a fairly serious bug.
Advice gratefully received, but I'll figure it out on my own, if not.
The most obvious kludge is to wrap the pps_unregister_cdev operations
in device_get/device_put, to force the release callback to be delayed
until later.
I'm hoping for something prettier, though. The other option I'm thinking
about is to move one or both deallocations to the (currently stub)
pps_cdev_release function.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists