AW: [PATCH] amd64: Fix csum_partial_copy_generic()

Vincent Whitchurch Vincent.Whitchurch at axis.com
Fri Oct 20 01:32:59 PDT 2023


On Thu, 2023-10-19 at 09:06 +0100, Al Viro wrote:
> diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
> index b8607763d113..6da09157f722 100644
> --- a/net/ipv4/icmp.c
> +++ b/net/ipv4/icmp.c
> @@ -376,6 +376,7 @@ static void icmp_push_reply(struct sock *sk,
>  	} else if ((skb = skb_peek(&sk->sk_write_queue)) != NULL) {
>  		struct icmphdr *icmph = icmp_hdr(skb);
>  		__wsum csum;
> +		__sum16 folded;
>  		struct sk_buff *skb1;
>  
> 
>  		csum = csum_partial_copy_nocheck((void *)&icmp_param->data,
> @@ -384,7 +385,8 @@ static void icmp_push_reply(struct sock *sk,
>  		skb_queue_walk(&sk->sk_write_queue, skb1) {
>  			csum = csum_add(csum, skb1->csum);
>  		}
> -		icmph->checksum = csum_fold(csum);
> +		folded = csum_fold(csum);
> +		icmph->checksum = folded ? folded : CSUM_MANGLED_0;
>  		skb->ip_summed = CHECKSUM_NONE;
>  		ip_push_pending_frames(sk, fl4);
>  	}

32-bit ARM is also affected since commit 1d60be3c25edf4b95 ("arm:
propagate the calling convention changes down to
csum_partial_copy_from_user()").

While the above fixes the ICMP reply case, are there other callers that
also need similar changes?  For example, I see net/sched/act_csum.c also
calculating ICMP checksums?



More information about the linux-arm-kernel mailing list