Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp657959rdf; Fri, 3 Nov 2023 10:58:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH3Ejw5ZI398mdbBrBWV6pO3QK+18CRQZ18e5JaSLNr0TiV+GCZqQxmR322g/gi8icfdxOk X-Received: by 2002:a17:903:11c3:b0:1cc:5549:aabd with SMTP id q3-20020a17090311c300b001cc5549aabdmr16682294plh.8.1699034284424; Fri, 03 Nov 2023 10:58:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699034284; cv=none; d=google.com; s=arc-20160816; b=cF7V7REv4fMcEzeqWM4UaUyd0U7B5qNgfsDoG7/qnzyJCwJTeo2NUcyW+odkQLef5h /AMNweSejUJM4eIRrWwfysflD8z656CRUv85v7fSduF1OdJeeNqO2f+dhgmU7ixQ4AH2 jWjXOBkhrp4Hmp7NAD7Mo5AScxWurAlID9iQ3Qxo+Oqb7sABitvHphF0fTHGqsZB7Wb8 KF6pz+ldepvt6R1TQNKQWillgW6emigEH3Ei3GkK0ChIjoELf9XlFhSXOUfBtvEfvakP zakuLxZNghTjgA7Ier18FLEN8F8P+tq+/IhD17+Z4+ZxW1rHGYlRTsi/Bw38hI4COX7S 24aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=10jqauWlqfvt/HR75hSWRIhJKNXu3uAakFmXumXKAxc=; fh=0ezxkVtJJoqD3Y0mjZkcJObgyt8idVpAXQSS/QmYP2o=; b=UAt4Hiajxjsuh8p71KOxiXcxDsiqj5DUn04AgacT4YDqUgj6BF8fK6RRBnkEu3kiD3 tPjCNDIm8fsh35CRzScdZTbvORr1Cb+5w3MawCgu5ZKX5Yj2MrsYx2kOk8ZDPWkICT9f M84vkxTqgqZNYN55XBt/KludzlK7dFk17gvweqaOqEeT8b1c7lzOZgs8KDnFV8Z3CSna aB7HpNOVQnuomw5MXYSyrjFjZO3Pj9SutBVU2Niy7O+bNm75qLPABgYAj3gjmaM+XjbW xyFd6VUM3xw8XF/e63IulIK6puPP1r7lTleQSmxYUmR0wY14MI8pXQU/3VyXuX5BLkzu E7wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=MCSzD4TB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id kt7-20020a170903088700b001bbaa5e95fdsi1886185plb.102.2023.11.03.10.58.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 10:58:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=MCSzD4TB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 1A5AE806A60C; Fri, 3 Nov 2023 10:57:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232839AbjKCR4G (ORCPT + 99 others); Fri, 3 Nov 2023 13:56:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232566AbjKCR4A (ORCPT ); Fri, 3 Nov 2023 13:56:00 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF329136; Fri, 3 Nov 2023 10:55:57 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-9d2e6c8b542so346259066b.0; Fri, 03 Nov 2023 10:55:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699034156; x=1699638956; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=10jqauWlqfvt/HR75hSWRIhJKNXu3uAakFmXumXKAxc=; b=MCSzD4TB7ZsG9U+wuhnzDVnohFihfVoB1INN+AAc3i6MoHdgWKIRtVVlMG+W0OVvUl 6CsyQZq5+inijcJvpDPyZBHW5Advns2hBw1baEF65eCNKM+Kgf1eOAou/4QfRY6gIO3A qZUan5fvsV69t3vj1san7KMv52nxewjtpulOxA2yo7Xj8To147rhyARoH4AVsum1KQoy qlNh6XKUzBxYQApB+5QPeS8xIEqBacS70ZnM+2z+6cQZBB9cw4AN8PlK31XTyCRED/U5 tFecs4SQbu7CBJJZ75rW8ukaWjBeyBDbO1IrVb1WpYSwuf69T1vmq+25E+8lQfTqpqqs gqSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699034156; x=1699638956; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=10jqauWlqfvt/HR75hSWRIhJKNXu3uAakFmXumXKAxc=; b=Km4dOqGzzgpL4oHf7mhi4HNwhuaqJIf4Mkb9MDpgxJviZERjS7JHG0JkZ0zg8N25XD vzvfl4CmilzBO8xlisF/Q6+WLiVFVyz0eyyBGo94P1VsMNOVT+a9fmcb7SNmsbQcC8Ou GXVJwkpeGUbBanex2WkziYte3/n/8yhcJLu6z31zWHEQ/zC9QW18n/ueFwkvscqXz70P kX4yRScCMYmPaGI4d2+8BvfNEsda0AwG0aVekOUXh1E2RffFB9O8tGSuhw/3pOEHqInK TiXExxKEHpgohHa30fdQ9uZzP8u3xeDISB0b1E6zxzFr1bib31WOj4mY/KVzbH1Y8vNZ 1srQ== X-Gm-Message-State: AOJu0Yy/ECOrvi4SYWQs0vUDXHCHTV8sKqGATbBsPn27CGJBlOs8JHNj 0CBmY/qtTf6Zc8ufPv6TBPw= X-Received: by 2002:a17:907:74b:b0:9ae:65a5:b6fa with SMTP id xc11-20020a170907074b00b009ae65a5b6famr7085261ejb.32.1699034155977; Fri, 03 Nov 2023 10:55:55 -0700 (PDT) Received: from fedora.. (host-62-211-113-16.retail.telecomitalia.it. [62.211.113.16]) by smtp.gmail.com with ESMTPSA id wj6-20020a170907050600b009ddf1a84379sm80306ejb.51.2023.11.03.10.55.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 10:55:55 -0700 (PDT) From: f.storniolo95@gmail.com To: luigi.leonardi@outlook.com, kvm@vger.kernel.org Cc: davem@davemloft.net, edumazet@google.com, mst@redhat.com, imbrenda@linux.vnet.ibm.com, kuba@kernel.org, asias@redhat.com, stefanha@redhat.com, pabeni@redhat.com, sgarzare@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Filippo Storniolo Subject: [PATCH net 2/4] test/vsock fix: add missing check on socket creation Date: Fri, 3 Nov 2023 18:55:49 +0100 Message-ID: <20231103175551.41025-3-f.storniolo95@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231103175551.41025-1-f.storniolo95@gmail.com> References: <20231103175551.41025-1-f.storniolo95@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 03 Nov 2023 10:57:51 -0700 (PDT) From: Filippo Storniolo Add check on socket() return value in vsock_listen() and vsock_connect() Co-developed-by: Luigi Leonardi Signed-off-by: Luigi Leonardi Signed-off-by: Filippo Storniolo --- tools/testing/vsock/util.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/testing/vsock/util.c b/tools/testing/vsock/util.c index 92336721321a..698b0b44a2ee 100644 --- a/tools/testing/vsock/util.c +++ b/tools/testing/vsock/util.c @@ -104,6 +104,10 @@ static int vsock_connect(unsigned int cid, unsigned int port, int type) control_expectln("LISTENING"); fd = socket(AF_VSOCK, type, 0); + if (fd < 0) { + perror("socket"); + exit(EXIT_FAILURE); + } timeout_begin(TIMEOUT); do { @@ -158,6 +162,10 @@ static int vsock_accept(unsigned int cid, unsigned int port, int old_errno; fd = socket(AF_VSOCK, type, 0); + if (fd < 0) { + perror("socket"); + exit(EXIT_FAILURE); + } if (bind(fd, &addr.sa, sizeof(addr.svm)) < 0) { perror("bind"); -- 2.41.0