We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2872e21 commit 9cb189aCopy full SHA for 9cb189a
drivers/dma-buf/udmabuf.c
@@ -436,14 +436,19 @@ static long udmabuf_create(struct miscdevice *device,
436
goto err;
437
}
438
439
+ /*
440
+ * Take the inode lock to protect against concurrent
441
+ * memfd_add_seals(), which takes this lock in write mode.
442
+ */
443
+ inode_lock_shared(file_inode(memfd));
444
ret = check_memfd_seals(memfd);
- if (ret < 0) {
- fput(memfd);
- goto err;
- }
445
+ if (ret)
446
+ goto out_unlock;
447
448
ret = udmabuf_pin_folios(ubuf, memfd, list[i].offset,
449
list[i].size, folios);
450
+out_unlock:
451
+ inode_unlock_shared(file_inode(memfd));
452
fput(memfd);
453
if (ret)
454
0 commit comments