Re: [PATCH net] net: tun: fix tun_napi_alloc_frags()

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

 



On Thu, Dec 12, 2024 at 10:22:47PM +0000, Eric Dumazet wrote:
> syzbot reported the following crash [1]
> 
> Issue came with the blamed commit. Instead of going through
> all the iov components, we keep using the first one
> and end up with a malformed skb.

[...]

> 
> Fixes: de4f5fed3f23 ("iov_iter: add iter_iovec() helper")
> Reported-by: syzbot+4f66250f6663c0c1d67e@xxxxxxxxxxxxxxxxxxxxxxxxx
> Closes: https://lore.kernel.org/netdev/675b61aa.050a0220.599f4.00bb.GAE@xxxxxxxxxx/T/#u
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Eric Dumazet <edumazet@xxxxxxxxxx>
> Cc: Jens Axboe <axboe@xxxxxxxxx>
> ---
>  drivers/net/tun.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index d7a865ef370b6968c095510ae16b5196e30e54b9..e816aaba8e5f2ed06f8832f79553b6c976e75bb8 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -1481,7 +1481,7 @@ static struct sk_buff *tun_napi_alloc_frags(struct tun_file *tfile,
>  	skb->truesize += skb->data_len;
>  
>  	for (i = 1; i < it->nr_segs; i++) {
> -		const struct iovec *iov = iter_iov(it);
> +		const struct iovec *iov = iter_iov(it) + i;
>  		size_t fragsz = iov->iov_len;
>  		struct page *page;
>  		void *frag;
> -- 

Reviewed-by: Joe Damato <jdamato@xxxxxxxxxx>




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux