[pve-devel] [PATCH container] Fix invalid device passthrough being added to config

Filip Schauer f.schauer at proxmox.com
Mon Apr 15 15:18:55 CEST 2024


On 11/04/2024 14:18, Fiona Ebner wrote:
>> -
>>   	my $absolute_path = $device->{path};
>>   	my ($mode, $rdev) = (stat($absolute_path))[2, 6];
>>   
>> -	die "Device $absolute_path does not exist\n" if $! == ENOENT;
>> -
>>   	die "Error accessing device $absolute_path\n"
>>   	    if (!defined($mode) || !defined($rdev));
>>   
>> -	die "$absolute_path is not a device\n"
>> -	    if (!S_ISBLK($mode) && !S_ISCHR($mode));
>> -
> Is there any downside to keeping these checks here as well? What a path
> points to might change in between being set in the config and some later
> time when the container is started, so these checks still make sense
> here IMHO. Could then become a helper function since it's used in two
> places, which would also reduce the amount of lines in the
> update_{pct,lxc}_config functions.

Good point, I sent a patch v2:
https://lists.proxmox.com/pipermail/pve-devel/2024-April/062973.html





More information about the pve-devel mailing list