From patchwork Tue Feb 2 02:36:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 8185861 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BF11ABEEE5 for ; Tue, 2 Feb 2016 02:38:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3337820259 for ; Tue, 2 Feb 2016 02:38:43 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 82B1620254 for ; Tue, 2 Feb 2016 02:38:42 +0000 (UTC) Received: from localhost ([::1]:54854 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQQrZ-0002eJ-Vq for patchwork-qemu-devel@patchwork.kernel.org; Mon, 01 Feb 2016 21:38:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQQpw-00081z-P8 for qemu-devel@nongnu.org; Mon, 01 Feb 2016 21:37:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aQQpv-0000AT-KH for qemu-devel@nongnu.org; Mon, 01 Feb 2016 21:37:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50885) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQQpv-0000AF-FM for qemu-devel@nongnu.org; Mon, 01 Feb 2016 21:36:59 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id EA9715A4A; Tue, 2 Feb 2016 02:36:58 +0000 (UTC) Received: from jason-ThinkPad-T430s.redhat.com (vpn1-6-248.pek2.redhat.com [10.72.6.248]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u122aNS3024254; Mon, 1 Feb 2016 21:36:52 -0500 From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Tue, 2 Feb 2016 10:36:09 +0800 Message-Id: <1454380581-7881-6-git-send-email-jasowang@redhat.com> In-Reply-To: <1454380581-7881-1-git-send-email-jasowang@redhat.com> References: <1454380581-7881-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Samuel Thibault , Jason Wang , Guillaume Subiron Subject: [Qemu-devel] [PULL 05/17] slirp: goto bad in udp_input if sosendto fails X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Guillaume Subiron Before this patch, if sosendto fails, udp_input is executed as if the packet was sent, recording the packet for icmp errors, which does not makes sense since the packet was not actually sent, errors would be related to a previous packet. This patch adds a goto bad to cut the execution of this function. Signed-off-by: Guillaume Subiron Signed-off-by: Samuel Thibault Reviewed-by: Thomas Huth Signed-off-by: Jason Wang --- slirp/udp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/slirp/udp.c b/slirp/udp.c index fee13b4..ce63414 100644 --- a/slirp/udp.c +++ b/slirp/udp.c @@ -218,6 +218,7 @@ udp_input(register struct mbuf *m, int iphlen) *ip=save_ip; DEBUG_MISC((dfd,"udp tx errno = %d-%s\n",errno,strerror(errno))); icmp_error(m, ICMP_UNREACH,ICMP_UNREACH_NET, 0,strerror(errno)); + goto bad; } m_free(so->so_m); /* used for ICMP if error on sorecvfrom */