mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 10:01:39 -05:00
Merge tag 'driver-core-6.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core
Pull driver core fixes from Danilo Krummrich: - Introduce DMA Rust helpers to avoid build errors when !CONFIG_HAS_DMA - Remove unnecessary (and hence incorrect) endian conversion in the Rust PCI driver sample code - Fix memory leak in the unwind path of debugfs_change_name() - Support non-const struct software_node pointers in SOFTWARE_NODE_REFERENCE(), after introducing _Generic() - Avoid NULL pointer dereference in the unwind path of simple_xattrs_free() * tag 'driver-core-6.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core: fs/kernfs: null-ptr deref in simple_xattrs_free() software node: Also support referencing non-constant software nodes debugfs: Fix memleak in debugfs_change_name(). samples: rust: fix endianness issue in rust_driver_pci rust: dma: add helpers for architectures without CONFIG_HAS_DMA
This commit is contained in:
@@ -841,8 +841,10 @@ int __printf(2, 3) debugfs_change_name(struct dentry *dentry, const char *fmt, .
|
|||||||
rd.new_parent = rd.old_parent;
|
rd.new_parent = rd.old_parent;
|
||||||
rd.flags = RENAME_NOREPLACE;
|
rd.flags = RENAME_NOREPLACE;
|
||||||
target = lookup_noperm_unlocked(&QSTR(new_name), rd.new_parent);
|
target = lookup_noperm_unlocked(&QSTR(new_name), rd.new_parent);
|
||||||
if (IS_ERR(target))
|
if (IS_ERR(target)) {
|
||||||
return PTR_ERR(target);
|
error = PTR_ERR(target);
|
||||||
|
goto out_free;
|
||||||
|
}
|
||||||
|
|
||||||
error = start_renaming_two_dentries(&rd, dentry, target);
|
error = start_renaming_two_dentries(&rd, dentry, target);
|
||||||
if (error) {
|
if (error) {
|
||||||
@@ -862,6 +864,7 @@ int __printf(2, 3) debugfs_change_name(struct dentry *dentry, const char *fmt, .
|
|||||||
out:
|
out:
|
||||||
dput(rd.old_parent);
|
dput(rd.old_parent);
|
||||||
dput(target);
|
dput(target);
|
||||||
|
out_free:
|
||||||
kfree_const(new_name);
|
kfree_const(new_name);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -681,8 +681,10 @@ static struct kernfs_node *__kernfs_new_node(struct kernfs_root *root,
|
|||||||
return kn;
|
return kn;
|
||||||
|
|
||||||
err_out4:
|
err_out4:
|
||||||
|
if (kn->iattr) {
|
||||||
simple_xattrs_free(&kn->iattr->xattrs, NULL);
|
simple_xattrs_free(&kn->iattr->xattrs, NULL);
|
||||||
kmem_cache_free(kernfs_iattrs_cache, kn->iattr);
|
kmem_cache_free(kernfs_iattrs_cache, kn->iattr);
|
||||||
|
}
|
||||||
err_out3:
|
err_out3:
|
||||||
spin_lock(&root->kernfs_idr_lock);
|
spin_lock(&root->kernfs_idr_lock);
|
||||||
idr_remove(&root->ino_idr, (u32)kernfs_ino(kn));
|
idr_remove(&root->ino_idr, (u32)kernfs_ino(kn));
|
||||||
|
|||||||
@@ -371,6 +371,7 @@ struct software_node_ref_args {
|
|||||||
(const struct software_node_ref_args) { \
|
(const struct software_node_ref_args) { \
|
||||||
.swnode = _Generic(_ref_, \
|
.swnode = _Generic(_ref_, \
|
||||||
const struct software_node *: _ref_, \
|
const struct software_node *: _ref_, \
|
||||||
|
struct software_node *: _ref_, \
|
||||||
default: NULL), \
|
default: NULL), \
|
||||||
.fwnode = _Generic(_ref_, \
|
.fwnode = _Generic(_ref_, \
|
||||||
struct fwnode_handle *: _ref_, \
|
struct fwnode_handle *: _ref_, \
|
||||||
|
|||||||
@@ -19,3 +19,24 @@ int rust_helper_dma_set_mask_and_coherent(struct device *dev, u64 mask)
|
|||||||
{
|
{
|
||||||
return dma_set_mask_and_coherent(dev, mask);
|
return dma_set_mask_and_coherent(dev, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int rust_helper_dma_set_mask(struct device *dev, u64 mask)
|
||||||
|
{
|
||||||
|
return dma_set_mask(dev, mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
int rust_helper_dma_set_coherent_mask(struct device *dev, u64 mask)
|
||||||
|
{
|
||||||
|
return dma_set_coherent_mask(dev, mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
int rust_helper_dma_map_sgtable(struct device *dev, struct sg_table *sgt,
|
||||||
|
enum dma_data_direction dir, unsigned long attrs)
|
||||||
|
{
|
||||||
|
return dma_map_sgtable(dev, sgt, dir, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t rust_helper_dma_max_mapping_size(struct device *dev)
|
||||||
|
{
|
||||||
|
return dma_max_mapping_size(dev);
|
||||||
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ fn testdev(index: &TestIndex, bar: &Bar0) -> Result<u32> {
|
|||||||
// Select the test.
|
// Select the test.
|
||||||
bar.write8(index.0, Regs::TEST);
|
bar.write8(index.0, Regs::TEST);
|
||||||
|
|
||||||
let offset = u32::from_le(bar.read32(Regs::OFFSET)) as usize;
|
let offset = bar.read32(Regs::OFFSET) as usize;
|
||||||
let data = bar.read8(Regs::DATA);
|
let data = bar.read8(Regs::DATA);
|
||||||
|
|
||||||
// Write `data` to `offset` to increase `count` by one.
|
// Write `data` to `offset` to increase `count` by one.
|
||||||
|
|||||||
Reference in New Issue
Block a user