Re: [PATCH] procfs: Fix a locking bug in a vmcore_add_device_dump() error path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 29, 2025 at 02:20:03PM -0800, Bart Van Assche wrote:
> Unlock vmcore_mutex when returning -EBUSY.
> 
> Cc: David Hildenbrand <david@xxxxxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: Michael S. Tsirkin <mst@xxxxxxxxxx>
> Fixes: 0f3b1c40c652 ("fs/proc/vmcore: disallow vmcore modifications while the vmcore is open")
> Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>

Acked-by: Michael S. Tsirkin <mst@xxxxxxxxxx>

> ---
>  fs/proc/vmcore.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c
> index a00120a3c099..10d01eb09c43 100644
> --- a/fs/proc/vmcore.c
> +++ b/fs/proc/vmcore.c
> @@ -1524,7 +1524,7 @@ int vmcore_add_device_dump(struct vmcoredd_data *data)
>  		pr_warn_once("Unexpected adding of device dump\n");
>  	if (vmcore_open) {
>  		ret = -EBUSY;
> -		goto out_err;
> +		goto unlock;
>  	}
>  
>  	list_add_tail(&dump->list, &vmcoredd_list);
> @@ -1532,6 +1532,9 @@ int vmcore_add_device_dump(struct vmcoredd_data *data)
>  	mutex_unlock(&vmcore_mutex);
>  	return 0;
>  
> +unlock:
> +	mutex_unlock(&vmcore_mutex);
> +
>  out_err:
>  	vfree(buf);
>  	vfree(dump);





[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux