fs/proc/vmcore: replace vmcoredd_mutex by vmcore_mutex
Now that we have a mutex that synchronizes against opening of the vmcore, let's use that one to replace vmcoredd_mutex: there is no need to have two separate ones. This is a preparation for properly preventing vmcore modifications after the vmcore was opened. Signed-off-by: David Hildenbrand <david@redhat.com> Message-Id: <20241204125444.1734652-3-david@redhat.com> Acked-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
cdbc69716f
commit
2083dfe45e
1 changed files with 8 additions and 9 deletions
|
@ -53,7 +53,6 @@ static struct proc_dir_entry *proc_vmcore;
|
|||
#ifdef CONFIG_PROC_VMCORE_DEVICE_DUMP
|
||||
/* Device Dump list and mutex to synchronize access to list */
|
||||
static LIST_HEAD(vmcoredd_list);
|
||||
static DEFINE_MUTEX(vmcoredd_mutex);
|
||||
|
||||
static bool vmcoredd_disabled;
|
||||
core_param(novmcoredd, vmcoredd_disabled, bool, 0);
|
||||
|
@ -248,7 +247,7 @@ static int vmcoredd_copy_dumps(struct iov_iter *iter, u64 start, size_t size)
|
|||
size_t tsz;
|
||||
char *buf;
|
||||
|
||||
mutex_lock(&vmcoredd_mutex);
|
||||
mutex_lock(&vmcore_mutex);
|
||||
list_for_each_entry(dump, &vmcoredd_list, list) {
|
||||
if (start < offset + dump->size) {
|
||||
tsz = min(offset + (u64)dump->size - start, (u64)size);
|
||||
|
@ -269,7 +268,7 @@ static int vmcoredd_copy_dumps(struct iov_iter *iter, u64 start, size_t size)
|
|||
}
|
||||
|
||||
out_unlock:
|
||||
mutex_unlock(&vmcoredd_mutex);
|
||||
mutex_unlock(&vmcore_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -283,7 +282,7 @@ static int vmcoredd_mmap_dumps(struct vm_area_struct *vma, unsigned long dst,
|
|||
size_t tsz;
|
||||
char *buf;
|
||||
|
||||
mutex_lock(&vmcoredd_mutex);
|
||||
mutex_lock(&vmcore_mutex);
|
||||
list_for_each_entry(dump, &vmcoredd_list, list) {
|
||||
if (start < offset + dump->size) {
|
||||
tsz = min(offset + (u64)dump->size - start, (u64)size);
|
||||
|
@ -306,7 +305,7 @@ static int vmcoredd_mmap_dumps(struct vm_area_struct *vma, unsigned long dst,
|
|||
}
|
||||
|
||||
out_unlock:
|
||||
mutex_unlock(&vmcoredd_mutex);
|
||||
mutex_unlock(&vmcore_mutex);
|
||||
return ret;
|
||||
}
|
||||
#endif /* CONFIG_MMU */
|
||||
|
@ -1518,9 +1517,9 @@ int vmcore_add_device_dump(struct vmcoredd_data *data)
|
|||
dump->size = data_size;
|
||||
|
||||
/* Add the dump to driver sysfs list */
|
||||
mutex_lock(&vmcoredd_mutex);
|
||||
mutex_lock(&vmcore_mutex);
|
||||
list_add_tail(&dump->list, &vmcoredd_list);
|
||||
mutex_unlock(&vmcoredd_mutex);
|
||||
mutex_unlock(&vmcore_mutex);
|
||||
|
||||
vmcoredd_update_size(data_size);
|
||||
return 0;
|
||||
|
@ -1538,7 +1537,7 @@ EXPORT_SYMBOL(vmcore_add_device_dump);
|
|||
static void vmcore_free_device_dumps(void)
|
||||
{
|
||||
#ifdef CONFIG_PROC_VMCORE_DEVICE_DUMP
|
||||
mutex_lock(&vmcoredd_mutex);
|
||||
mutex_lock(&vmcore_mutex);
|
||||
while (!list_empty(&vmcoredd_list)) {
|
||||
struct vmcoredd_node *dump;
|
||||
|
||||
|
@ -1548,7 +1547,7 @@ static void vmcore_free_device_dumps(void)
|
|||
vfree(dump->buf);
|
||||
vfree(dump);
|
||||
}
|
||||
mutex_unlock(&vmcoredd_mutex);
|
||||
mutex_unlock(&vmcore_mutex);
|
||||
#endif /* CONFIG_PROC_VMCORE_DEVICE_DUMP */
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue