Merge lp:~crimsun/udev/ubuntu into lp:~ubuntu-core-dev/udev/ubuntu

Proposed by Daniel T Chen
Status: Needs review
Proposed branch: lp:~crimsun/udev/ubuntu
Merge into: lp:~ubuntu-core-dev/udev/ubuntu
Diff against target: None lines
To merge this branch: bzr merge lp:~crimsun/udev/ubuntu
Reviewer Review Type Date Requested Status
Scott James Remnant (Canonical) (community) Disapprove
Review via email: mp+9883@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Daniel T Chen (crimsun) wrote :

According to https://tango.0pointer.de/pipermail/pulseaudio-discuss/2009-August/004674.html, Lennart strongly recommends that we merge his patch (merged into udev.git upstream, changeset 3bf768245b98479a14190e1e1d32ef5fae3ddf8a) to fix an ACL race affecting profile creation.

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

If this is an important issue, we should just get a new version of udev released upstream and update to that.

review: Disapprove

Unmerged revisions

2500. By Daniel T Chen <crimsun@errno>

Update changelog

2499. By Daniel T Chen <crimsun@errno>

Apply 3bf768245b98479a14190e1e1d32ef5fae3ddf8a from upstream upon Lennart's recommendation

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2009-07-18 13:43:22 +0000
+++ debian/changelog 2009-08-08 18:51:09 +0000
@@ -3,6 +3,10 @@
3 [ Scott James Remnant ]3 [ Scott James Remnant ]
4 * 4 *
55
6 [ Daniel T Chen ]
7 * Apply 3bf768245b98479a14190e1e1d32ef5fae3ddf8a from upstream
8 to fix an ACL race
9
6 [ Martin Pitt ]10 [ Martin Pitt ]
7 * debian/control: Add missing Breaks: casper (<< 1.174) to avoid breaking11 * debian/control: Add missing Breaks: casper (<< 1.174) to avoid breaking
8 upgrades from jaunty in wubi installations. (LP: #400138)12 upgrades from jaunty in wubi installations. (LP: #400138)
913
=== modified file 'libudev/libudev-enumerate.c'
--- libudev/libudev-enumerate.c 2009-07-08 00:04:49 +0000
+++ libudev/libudev-enumerate.c 2009-08-08 18:48:37 +0000
@@ -187,7 +187,8 @@
187 return ret;187 return ret;
188}188}
189189
190static int devices_delay(struct udev *udev, const char *syspath)190/* For devices that should be moved to the absolute end of the list */
191static int devices_delay_end(struct udev *udev, const char *syspath)
191{192{
192 static const char *delay_device_list[] = {193 static const char *delay_device_list[] = {
193 "/block/md",194 "/block/md",
@@ -207,6 +208,32 @@
207 return 0;208 return 0;
208}209}
209210
211/* For devices that should just be moved a little bit later, just
212 * before the point where some common path prefix changes. Returns the
213 * number of characters that make up that common prefix */
214static size_t devices_delay_later(struct udev *udev, const char *syspath)
215{
216 const char *c;
217
218 /* For sound cards the control device must be enumerated last
219 * to make sure it's the final device node that gets ACLs
220 * applied. Applications rely on this fact and use ACL changes
221 * on the control node as an indicator that the ACL change of
222 * the entire sound card completed. The kernel makes this
223 * guarantee when creating those devices, and hence we should
224 * too when enumerating them. */
225
226 if ((c = strstr(syspath, "/sound/card"))) {
227 c += 11;
228 c += strcspn(c, "/");
229
230 if (strncmp(c, "/controlC", 9) == 0)
231 return c - syspath + 1;
232 }
233
234 return 0;
235}
236
210/**237/**
211 * udev_enumerate_get_list_entry:238 * udev_enumerate_get_list_entry:
212 * @udev_enumerate: context239 * @udev_enumerate: context
@@ -220,7 +247,8 @@
220 if (!udev_enumerate->devices_uptodate) {247 if (!udev_enumerate->devices_uptodate) {
221 unsigned int i;248 unsigned int i;
222 unsigned int max;249 unsigned int max;
223 struct syspath *prev = NULL;250 struct syspath *prev = NULL, *move_later = NULL;
251 size_t move_later_prefix;
224252
225 udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->devices_list);253 udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->devices_list);
226 qsort(udev_enumerate->devices, udev_enumerate->devices_cur, sizeof(struct syspath), syspath_cmp);254 qsort(udev_enumerate->devices, udev_enumerate->devices_cur, sizeof(struct syspath), syspath_cmp);
@@ -237,14 +265,39 @@
237 prev = entry;265 prev = entry;
238266
239 /* skip to be delayed devices, and add them to the end of the list */267 /* skip to be delayed devices, and add them to the end of the list */
240 if (devices_delay(udev_enumerate->udev, entry->syspath)) {268 if (devices_delay_end(udev_enumerate->udev, entry->syspath)) {
241 syspath_add(udev_enumerate, entry->syspath);269 syspath_add(udev_enumerate, entry->syspath);
242 continue;270 continue;
243 }271 }
244272
273 /* skip to be delayed devices, and move the to
274 * the point where the prefix changes. We can
275 * only move one item at a time. */
276 if (!move_later) {
277 move_later_prefix = devices_delay_later(udev_enumerate->udev, entry->syspath);
278
279 if (move_later_prefix > 0) {
280 move_later = entry;
281 continue;
282 }
283 }
284
285 if (move_later &&
286 strncmp(entry->syspath, move_later->syspath, move_later_prefix) != 0) {
287
288 udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list,
289 move_later->syspath, NULL, 0, 0);
290 move_later = NULL;
291 }
292
245 udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list,293 udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list,
246 entry->syspath, NULL, 0, 0);294 entry->syspath, NULL, 0, 0);
247 }295 }
296
297 if (move_later)
298 udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list,
299 move_later->syspath, NULL, 0, 0);
300
248 /* add and cleanup delayed devices from end of list */301 /* add and cleanup delayed devices from end of list */
249 for (i = max; i < udev_enumerate->devices_cur; i++) {302 for (i = max; i < udev_enumerate->devices_cur; i++) {
250 struct syspath *entry = &udev_enumerate->devices[i];303 struct syspath *entry = &udev_enumerate->devices[i];

Subscribers

People subscribed via source and target branches