From patchwork Wed Jul 3 16:46:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 1956357 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=QlT/7NC/; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=sipsolutions.net header.i=@sipsolutions.net header.a=rsa-sha256 header.s=mail header.b=dRqyIPf+; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WDlzX0x71z1xqh for ; Thu, 4 Jul 2024 02:46:32 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=fycvKmLgeiYd1SRgq+dLQenVWrb2UcKrh6RMo5yFYo8=; b=QlT/7NC/6S26hrnHVzyHmshZJr TGmwcPQjEQzOLVh7JONe9HxaIMu4nUGr6B3w05Y3mSKO8kv/uxhV9cK1trw3++BYzik3oJG94UP2B tii65xsaLe6EDEzsjZQJEi/pZXSqJltSKu/snhm2rIOhtJbBnrVTZys2Wrh0hVo6wnfSN3A3Le6oh I/S1SpF3u4r6FpCcYV3ig79a9alQzAtwkjH88mjZi7TOk0Wp2UNh1QhNEFl1cXFs39S633yxHZ4qW AJo/i89dWtkK792dd92JBJVM2w87VlLbtE22swzlP+K/lYuCH3VSBS2W7fcN+l4267BJ7+j57g3vQ CqIq74sg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP37l-0000000AtGf-45B8; Wed, 03 Jul 2024 16:46:29 +0000 Received: from s3.sipsolutions.net ([2a01:4f8:242:246e::2] helo=sipsolutions.net) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP37j-0000000AtGA-1ZLH for linux-um@lists.infradead.org; Wed, 03 Jul 2024 16:46:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-To:Resent-Cc: Resent-Message-ID:In-Reply-To:References; bh=fycvKmLgeiYd1SRgq+dLQenVWrb2UcKrh6RMo5yFYo8=; t=1720025187; x=1721234787; b=dRqyIPf+1jrrgekpO7WYvXsE7N/PCi0bCcsZJZ0EMEvxHSftC5xihSVzH/uLzGEBWfo4YmTHQWS PiyywiMrkdmpnQt7sEGO6JlVVISCmVkunDJAc6NmO54l+Jyo3YQTVArU4lPQQs7OS+gqeqcX0Wxv+ DF5FN+VS7820deVKdK769VPj5OodPYYC8QSnmfiyP4prDSzfkWxpwETAKTM4CTdyIdyD8aYnoaea3 qmCWsZ69dQoq4D8vFcfsyYlv3MjZDEc2a2YCdeqayFEcHNf/9dEk88QATZs+bPGbexEEFv8Tdgvmn POmABiXVM7iCHEbbqxi2ygwbddJhq1ZQQUzw==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1sP37g-00000009d05-3MBs; Wed, 03 Jul 2024 18:46:25 +0200 From: Johannes Berg To: linux-um@lists.infradead.org Cc: Johannes Berg Subject: [PATCH] um: vector: always reset vp->opened Date: Wed, 3 Jul 2024 18:46:23 +0200 Message-ID: <20240703184622.df40c5c38461.Id4e20b48938c6019d99e6133227a34ac059db466@changeid> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240703_094627_438514_3FE5D838 X-CRM114-Status: GOOD ( 10.60 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Johannes Berg If open fails, we have already set vp->opened, but it's not reset so that any further attempts will just return -ENXIO. Reset vp->opened even if close has nothing to do. Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Johannes Berg If open fails, we have already set vp->opened, but it's not reset so that any further attempts will just return -ENXIO. Reset vp->opened even if close has nothing to do. This helps e.g. with slirp4netns handling only a single connection, you can then restart it and open the device again. Signed-off-by: Johannes Berg Acked-By: Anton Ivanov --- arch/um/drivers/vector_kern.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c index 0861e32d2fbd..2d473282ab51 100644 --- a/arch/um/drivers/vector_kern.c +++ b/arch/um/drivers/vector_kern.c @@ -1119,6 +1119,8 @@ static int vector_net_close(struct net_device *dev) netif_stop_queue(dev); del_timer(&vp->tl); + vp->opened = false; + if (vp->fds == NULL) return 0; @@ -1157,7 +1159,6 @@ static int vector_net_close(struct net_device *dev) destroy_queue(vp->tx_queue); kfree(vp->fds); vp->fds = NULL; - vp->opened = false; vp->in_error = false; return 0; }