* [PATCH v3] iov_iter: don't revert iov buffer if csum error
@ 2017-05-03 7:02 Ding Tianhong
2017-05-03 7:07 ` Al Viro
2017-05-03 7:15 ` Miss it//Re: " Ding Tianhong
0 siblings, 2 replies; 3+ messages in thread
From: Ding Tianhong @ 2017-05-03 7:02 UTC (permalink / raw)
To: David Miller, pabeni, edumazet, hannes, netdev, linux-kernel,
LinuxArm, weiyongjun (A),
Al Viro
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.
v2: Sabrina notice that return -EFAULT when checksum error is not correct
here, it would confuse the caller about the return value, so fix it.
v3: According AI's suggestion, directly return -EINVAL when __skb_checksum_complete()
return error is a more simple solution.
Fixes: 327868212381 ("make skb_copy_datagram_msg() et.al. preserve->msg_iter on error")
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
net/core/datagram.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/datagram.c b/net/core/datagram.c
index 0306543..726bf8a 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -719,7 +719,7 @@ int skb_copy_and_csum_datagram_msg(struct sk_buff *skb,
if (msg_data_left(msg) < chunk) {
if (__skb_checksum_complete(skb))
- goto csum_error;
+ return -EINVAL;
if (skb_copy_datagram_msg(skb, hlen, msg, chunk))
goto fault;
} else {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3] iov_iter: don't revert iov buffer if csum error
2017-05-03 7:02 [PATCH v3] iov_iter: don't revert iov buffer if csum error Ding Tianhong
@ 2017-05-03 7:07 ` Al Viro
2017-05-03 7:15 ` Miss it//Re: " Ding Tianhong
1 sibling, 0 replies; 3+ messages in thread
From: Al Viro @ 2017-05-03 7:07 UTC (permalink / raw)
To: Ding Tianhong
Cc: David Miller, pabeni, edumazet, hannes, netdev, linux-kernel,
LinuxArm, weiyongjun (A)
On Wed, May 03, 2017 at 03:02:32PM +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.
See a6a5993243550b09f620941dea741b7421fdf79c in mainline...
^ permalink raw reply [flat|nested] 3+ messages in thread
* Miss it//Re: [PATCH v3] iov_iter: don't revert iov buffer if csum error
2017-05-03 7:02 [PATCH v3] iov_iter: don't revert iov buffer if csum error Ding Tianhong
2017-05-03 7:07 ` Al Viro
@ 2017-05-03 7:15 ` Ding Tianhong
1 sibling, 0 replies; 3+ messages in thread
From: Ding Tianhong @ 2017-05-03 7:15 UTC (permalink / raw)
To: David Miller, pabeni, edumazet, hannes, netdev, linux-kernel,
LinuxArm, weiyongjun (A),
Al Viro
Miss it, it is already in the kernel tree, sorry for the noisy.
On 2017/5/3 15:02, 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.
>
> v2: Sabrina notice that return -EFAULT when checksum error is not correct
> here, it would confuse the caller about the return value, so fix it.
>
> v3: According AI's suggestion, directly return -EINVAL when __skb_checksum_complete()
> return error is a more simple solution.
>
> Fixes: 327868212381 ("make skb_copy_datagram_msg() et.al. preserve->msg_iter on error")
> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
> net/core/datagram.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/core/datagram.c b/net/core/datagram.c
> index 0306543..726bf8a 100644
> --- a/net/core/datagram.c
> +++ b/net/core/datagram.c
> @@ -719,7 +719,7 @@ int skb_copy_and_csum_datagram_msg(struct sk_buff *skb,
>
> if (msg_data_left(msg) < chunk) {
> if (__skb_checksum_complete(skb))
> - goto csum_error;
> + return -EINVAL;
> if (skb_copy_datagram_msg(skb, hlen, msg, chunk))
> goto fault;
> } else {
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-03 7:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-03 7:02 [PATCH v3] iov_iter: don't revert iov buffer if csum error Ding Tianhong
2017-05-03 7:07 ` Al Viro
2017-05-03 7:15 ` Miss it//Re: " Ding Tianhong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).