Re: [PATCH v2] iov_iter: don't revert iov buffer if csum error
From: Al Viro
Date: Fri Apr 28 2017 - 23:36:50 EST
On Sat, Apr 29, 2017 at 10:38:48AM +0800, Ding Tianhong wrote:
> The patch 327868212381 (make skb_copy_datagram_msg() et.al. preserve
> ->msg_iter on error) will revert the iov buffer if copy to iter
> failed, but it didn't copy any datagram if the skb_checksum_complete
> error, so no need to revert any data at this place.
The bug is real, but I would suggest a simpler fix:
if (__skb_checksum_complete(skb))
return -EINVAL;
leaving the rest as-is.