Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1634779 > unrolled thread

[PATCH v3] iov_iter: don't revert iov buffer if csum error

Started byDing Tianhong <dingtianhong@huawei.com>
First post2017-05-03 09:10 +0200
Last post2017-05-03 09:30 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH v3] iov_iter: don't revert iov buffer if csum error Ding Tianhong <dingtianhong@huawei.com> - 2017-05-03 09:10 +0200
    Miss it//Re: [PATCH v3] iov_iter: don't revert iov buffer if csum  error Ding Tianhong <dingtianhong@huawei.com> - 2017-05-03 09:30 +0200

#1634779 — [PATCH v3] iov_iter: don't revert iov buffer if csum error

FromDing Tianhong <dingtianhong@huawei.com>
Date2017-05-03 09:10 +0200
Subject[PATCH v3] iov_iter: don't revert iov buffer if csum error
Message-ID<tCWAa-1Hv-13@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1634782 — Miss it//Re: [PATCH v3] iov_iter: don't revert iov buffer if csum error

FromDing Tianhong <dingtianhong@huawei.com>
Date2017-05-03 09:30 +0200
SubjectMiss it//Re: [PATCH v3] iov_iter: don't revert iov buffer if csum error
Message-ID<tCWTw-1Q1-9@gated-at.bofh.it>
In reply to#1634779
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 {
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web