From patchwork Wed May 3 07:02:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ding Tianhong X-Patchwork-Id: 98467 Delivered-To: patch@linaro.org Received: by 10.140.89.200 with SMTP id v66csp163452qgd; Wed, 3 May 2017 00:05:32 -0700 (PDT) X-Received: by 10.98.34.212 with SMTP id p81mr3180395pfj.118.1493795132299; Wed, 03 May 2017 00:05:32 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l25si13165238pli.42.2017.05.03.00.05.32; Wed, 03 May 2017 00:05:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751539AbdECHEE (ORCPT + 6 others); Wed, 3 May 2017 03:04:04 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:5852 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751014AbdECHEB (ORCPT ); Wed, 3 May 2017 03:04:01 -0400 Received: from 172.30.72.56 (EHLO dggeml406-hub.china.huawei.com) ([172.30.72.56]) by dggrg02-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id AMV77592; Wed, 03 May 2017 15:02:47 +0800 (CST) Received: from [127.0.0.1] (10.177.23.32) by dggeml406-hub.china.huawei.com (10.3.17.50) with Microsoft SMTP Server id 14.3.301.0; Wed, 3 May 2017 15:02:35 +0800 From: Ding Tianhong Subject: [PATCH v3] iov_iter: don't revert iov buffer if csum error To: David Miller , , , , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , LinuxArm , "weiyongjun (A)" , Al Viro Message-ID: <12d4d81f-40c7-c83d-11d6-290acc084695@huawei.com> Date: Wed, 3 May 2017 15:02:32 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 X-Originating-IP: [10.177.23.32] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.5909809A.00DA, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 3cbfbd0de1f14df1fdb9315a8fc94baf Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 Signed-off-by: Wei Yongjun --- net/core/datagram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 1.8.3.1 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 {