Message ID | 1725018997-363706-4-git-send-email-steven.sistare@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 25696CA0FE1 for <qemu-devel@archiver.kernel.org>; Fri, 30 Aug 2024 11:57:24 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <qemu-devel-bounces@nongnu.org>) id 1sk0FG-0007JV-4b; Fri, 30 Aug 2024 07:56:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <steven.sistare@oracle.com>) id 1sk0FC-0007I6-17 for qemu-devel@nongnu.org; Fri, 30 Aug 2024 07:56:46 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <steven.sistare@oracle.com>) id 1sk0FA-0002rR-Aq for qemu-devel@nongnu.org; Fri, 30 Aug 2024 07:56:45 -0400 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47U7tZTw031532; Fri, 30 Aug 2024 11:56:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= corp-2023-11-20; bh=ROwlq54X8+1gliWKwzPqTLa3CsUyWttmLlk2LsjV5yk=; b= M3nA2L4CEEfIb+hUn3tA8/8rKmptI/LfUTgxi8N7p3b+8MVInL1fHoVSZhxhOk0z YmTX7JVuUBGRNkbc8b4tjC6EHuaRx3jIubSDmqeKYnZBfF/kXUHbFPBM567Teb1d QeIZ3DdedDlroFz59B7fxDTEbolWxEKbFx29xbWHbuyNo4ftlf6+n1P4RndWFRNe h/EQZ1rFJxOKvtqOY6Q8Q4wXb/HuBCN0lGuOJnI7CHLkVH2228NuwVuHl01dagSd 1DGdJ1O0vYqF59ZqWRKrtH3d4QNP6cUw+AMHsyR9LHraAliEbba1zyU7vG1+nURw q5qgGoPvJlGoYpF62ZPquw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 41b9v7gdmf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 30 Aug 2024 11:56:42 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 47UA25Ga036638; Fri, 30 Aug 2024 11:56:41 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 4189jpg9ca-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 30 Aug 2024 11:56:41 +0000 Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 47UBucxM028887; Fri, 30 Aug 2024 11:56:41 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 4189jpg9ae-4; Fri, 30 Aug 2024 11:56:41 +0000 From: Steve Sistare <steven.sistare@oracle.com> To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>, Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>, Euan Turner <euan.turner@nutanix.com>, Steve Sistare <steven.sistare@oracle.com> Subject: [RFC V1 3/6] tap: fix net_init_tap() return code Date: Fri, 30 Aug 2024 04:56:34 -0700 Message-Id: <1725018997-363706-4-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1725018997-363706-1-git-send-email-steven.sistare@oracle.com> References: <1725018997-363706-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-30_06,2024-08-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 suspectscore=0 phishscore=0 malwarescore=0 bulkscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408300090 X-Proofpoint-GUID: NFb72nmgwvntJ81V_2PunCe6wkYbQ0ke X-Proofpoint-ORIG-GUID: NFb72nmgwvntJ81V_2PunCe6wkYbQ0ke Received-SPF: pass client-ip=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org |
Series |
Live Update: tap and vhost
|
expand
|
diff --git a/net/tap.c b/net/tap.c index 8deabcb..20e4dae 100644 --- a/net/tap.c +++ b/net/tap.c @@ -855,8 +855,8 @@ int net_init_tap(const Netdev *netdev, const char *name, goto free_fail; } - ret = g_unix_set_fd_nonblocking(fd, true, NULL); - if (!ret) { + if (!g_unix_set_fd_nonblocking(fd, true, NULL)) { + ret = -1; error_setg_errno(errp, errno, "%s: Can't use file descriptor %d", name, fd); goto free_fail;
When net_init_tap() succeeds for a multi-queue device, it returns a non-zero ret=1 code to its caller, because of this code where ret becomes 1 when g_unix_set_fd_nonblocking succeeds. Luckily, the only current call site checks for negative, rather than non-zero. ret = g_unix_set_fd_nonblocking(fd, true, NULL); if (!ret) { ... goto free_fail; Also, if g_unix_set_fd_nonblocking fails (though unlikely), ret=0 is returned, and the caller will use a broken interface. Signed-off-by: Steve Sistare <steven.sistare@oracle.com> --- net/tap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)