linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iov_iter: don't revert if csum error
@ 2017-04-28 12:48 Ding Tianhong
  2017-04-28 13:16 ` Sabrina Dubroca
  0 siblings, 1 reply; 4+ messages in thread
From: Ding Tianhong @ 2017-04-28 12:48 UTC (permalink / raw)
  To: David Miller, pabeni, edumazet, hannes, netdev, linux-kernel, LinuxArm

The patch 3278682 (make skb_copy_datagram_msg() et.al. preserve
->msg_iter on error) will revert the iov buffer if copy to iter
failed, but it looks no need to revert for csum error, so fix it.

Fixes: 3278682 ("make skb_copy_datagram_msg() et.al. preserve->msg_iter on error")
Signed-off-by: Ding Tianhong <dingtianhong@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 f4947e7..475a8e9 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -760,7 +760,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;
+			goto fault;
 		if (skb_copy_datagram_msg(skb, hlen, msg, chunk))
 			goto fault;
 	} else {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] iov_iter: don't revert if csum error
  2017-04-28 12:48 [PATCH] iov_iter: don't revert if csum error Ding Tianhong
@ 2017-04-28 13:16 ` Sabrina Dubroca
  2017-04-28 13:51   ` David Laight
  2017-04-29  2:12   ` Ding Tianhong
  0 siblings, 2 replies; 4+ messages in thread
From: Sabrina Dubroca @ 2017-04-28 13:16 UTC (permalink / raw)
  To: Ding Tianhong
  Cc: David Miller, pabeni, edumazet, hannes, netdev, linux-kernel, LinuxArm

2017-04-28, 20:48:45 +0800, Ding Tianhong wrote:
> The patch 3278682 (make skb_copy_datagram_msg() et.al. preserve
> ->msg_iter on error) will revert the iov buffer if copy to iter
> failed, but it looks no need to revert for csum error, so fix it.
> 
> Fixes: 3278682 ("make skb_copy_datagram_msg() et.al. preserve->msg_iter on error")

Please use 12 digits, ie 327868212381.

> Signed-off-by: Ding Tianhong <dingtianhong@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 f4947e7..475a8e9 100644
> --- a/net/core/datagram.c
> +++ b/net/core/datagram.c
> @@ -760,7 +760,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;
> +			goto fault;

With this patch, skb_copy_and_csum_datagram_msg() will return -EFAULT
for an incorrect checksum, that doesn't seem right.

>  		if (skb_copy_datagram_msg(skb, hlen, msg, chunk))
>  			goto fault;
>  	} else {
> -- 
> 1.8.3.1
> 

-- 
Sabrina

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] iov_iter: don't revert if csum error
  2017-04-28 13:16 ` Sabrina Dubroca
@ 2017-04-28 13:51   ` David Laight
  2017-04-29  2:12   ` Ding Tianhong
  1 sibling, 0 replies; 4+ messages in thread
From: David Laight @ 2017-04-28 13:51 UTC (permalink / raw)
  To: 'Sabrina Dubroca', Ding Tianhong
  Cc: David Miller, pabeni, edumazet, hannes, netdev, linux-kernel, LinuxArm

From: Sabrina Dubroca
> Sent: 28 April 2017 14:17
...
> >  		if (__skb_checksum_complete(skb))
> > -			goto csum_error;
> > +			goto fault;
> 
> With this patch, skb_copy_and_csum_datagram_msg() will return -EFAULT
> for an incorrect checksum, that doesn't seem right.

Especially since (IIRC) -EFAULT generates SIGSEGV.

	David

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] iov_iter: don't revert if csum error
  2017-04-28 13:16 ` Sabrina Dubroca
  2017-04-28 13:51   ` David Laight
@ 2017-04-29  2:12   ` Ding Tianhong
  1 sibling, 0 replies; 4+ messages in thread
From: Ding Tianhong @ 2017-04-29  2:12 UTC (permalink / raw)
  To: Sabrina Dubroca
  Cc: David Miller, pabeni, edumazet, hannes, netdev, linux-kernel, LinuxArm



On 2017/4/28 21:16, Sabrina Dubroca wrote:
> 2017-04-28, 20:48:45 +0800, Ding Tianhong wrote:
>> The patch 3278682 (make skb_copy_datagram_msg() et.al. preserve
>> ->msg_iter on error) will revert the iov buffer if copy to iter
>> failed, but it looks no need to revert for csum error, so fix it.
>>
>> Fixes: 3278682 ("make skb_copy_datagram_msg() et.al. preserve->msg_iter on error")
> 
> Please use 12 digits, ie 327868212381.
> 
>> Signed-off-by: Ding Tianhong <dingtianhong@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 f4947e7..475a8e9 100644
>> --- a/net/core/datagram.c
>> +++ b/net/core/datagram.c
>> @@ -760,7 +760,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;
>> +			goto fault;
> 
> With this patch, skb_copy_and_csum_datagram_msg() will return -EFAULT
> for an incorrect checksum, that doesn't seem right.
> 

Yes, should not change the return value, thanks.

Ding

>>  		if (skb_copy_datagram_msg(skb, hlen, msg, chunk))
>>  			goto fault;
>>  	} else {
>> -- 
>> 1.8.3.1
>>
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-04-29  2:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-28 12:48 [PATCH] iov_iter: don't revert if csum error Ding Tianhong
2017-04-28 13:16 ` Sabrina Dubroca
2017-04-28 13:51   ` David Laight
2017-04-29  2:12   ` 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).