Re: [PATCH] fs/proc/kcore.c: Clear ret value in read_kcore_iter after successful iov_iter_zero

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

 



On Fri, Nov 22, 2024 at 12:11:18AM +0100, Jiri Olsa wrote:
> If iov_iter_zero succeeds after failed copy_from_kernel_nofault,
> we need to reset the ret value to zero otherwise it will be returned
> as final return value of read_kcore_iter.
> 
> This fixes objdump -d dump over /proc/kcore for me.
> 
> Cc: stable@xxxxxxxxxxxxxxx
> Cc: Alexander Gordeev <agordeev@xxxxxxxxxxxxx>
> Fixes: 3d5854d75e31 ("fs/proc/kcore.c: allow translation of physical memory addresses")
> Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
> ---
>  fs/proc/kcore.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
> index 51446c59388f..c82c408e573e 100644
> --- a/fs/proc/kcore.c
> +++ b/fs/proc/kcore.c
> @@ -600,6 +600,7 @@ static ssize_t read_kcore_iter(struct kiocb *iocb, struct iov_iter *iter)
>  					ret = -EFAULT;
>  					goto out;
>  				}
> +				ret = 0;
>  			/*
>  			 * We know the bounce buffer is safe to copy from, so
>  			 * use _copy_to_iter() directly.

Acked-by: Alexander Gordeev <agordeev@xxxxxxxxxxxxx>

Thank you, Jiri!




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux