Message ID | 20210817120451.8718-1-adrian.frances@netduma.com |
---|---|
State | Superseded |
Delegated to: | Petr Štetiar |
Headers | show
Return-Path: <openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=<UNKNOWN>) Authentication-Results: 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=j+y1FZEh; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=netduma-com.20150623.gappssmtp.com header.i=@netduma-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=qHB89+7a; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GpqXS34z7z9s24 for <incoming@patchwork.ozlabs.org>; Tue, 17 Aug 2021 22:07:20 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=+C5PCW/DEdSu+RrxWvo30QVS0N6sXinMZROgBeI2TJg=; b=j+y1FZEhXyWWwM 7PSTsrawjrANNz8CqdNIn+FHDC0sGn8Ok7HAbeq0rsLk396S0Zy1cwcEaXOPl+wuo7iWW5HWfMH9Q hFTqauaatMgYpsVGRlUOiF+6MkWkmTO2wz/LWW1EXym33vDlQvImXn5t8+JBLoUu2C5TOlA7cp5MC 9TaEkxlPgqpx8Fm3QCARjYbc04moIzC7mUXS/FzK9Pm3u7GzpaVGJyp7iOK3YdiFzUFFcRfHB8jaL NipkRgx2I506YRzivY1Z7zhibbdct+9vUMnmglqp5lp0utjOTli0jU2w0fD5D3UW1SdvLfbB1xsWI OunePGdj8mqGppAqLEVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mFxqG-002MY8-MD; Tue, 17 Aug 2021 12:05:16 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mFxqC-002MX9-W2 for openwrt-devel@lists.openwrt.org; Tue, 17 Aug 2021 12:05:14 +0000 Received: by mail-wm1-x335.google.com with SMTP id k5-20020a05600c1c85b02902e699a4d20cso1972383wms.2 for <openwrt-devel@lists.openwrt.org>; Tue, 17 Aug 2021 05:05:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netduma-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=q7WIQ5tetHFwQM6zqqnivmwh699Bc65cbh+/vpyo2+0=; b=qHB89+7aIGYMPFlgcyzIPkV34T5mmEPFzM/6MFRAnqCU4XGhZ9DC6+E8Y/fKQMTwyz CUNOz5UoHqSfTmA4ueewP+xqm4pVv7XSozm0ZL9NFdduuHSiN4pYXvoKwjKi0g2Zs2os DGux553Lmq/cUL46ra5ctQbYB2fy0MnXBKXcqbVbWv3oOoq24iqROTDCJmars1sMO17y CVLoaoU//Vz728uFHjUvK/pQISXURSuN2kfsWIu8llvtp2BTElPhYKKn1lx7P+WK7+K3 2zmhxErJfCr/adp2LvKx7ED4OD1v2xt+0V+olVRz/Rrzvk0yWTHE6v7PmS0bMRIuBcRh ohww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=q7WIQ5tetHFwQM6zqqnivmwh699Bc65cbh+/vpyo2+0=; b=YyPJt9lXeLkPGdmkOhGjCbsUFvjgg5FFZVXhwc1auCnLCNdOLWfAryquXjodoeXFiT OsZW+Uj7RSEDd4J00WTKUqBtkcd5YKeQ6S+9bEcKppbsKCBELAznxe/g6U+bGCWfFOpG sGskbub/RbrQR8KURo4o+phMfT5c3xMMkN7XRmP48B//n0PHfU36iDYv53v1CfN2NK7a aFv9et3A1KfCnNNT6Cb4fzjemOTJlVJMpnUp0NE1zpgVXFcnMhkUL3S470KMoFdyXGeW YmDxvJ3wETb9ls1XqlRbw4njcPGk4Y8ZMLMwZgzO3JoJ3gEkUPZrRQEryT0tqGmzVGK7 pXkA== X-Gm-Message-State: AOAM532VT6Ll2/lNhYdXwHKpOclTiyEogjcBTTIsy4kyNGHo5HlsO6V0 ViRhNZwdNMrfRiBHqhvSICw9/notcPBWXITr X-Google-Smtp-Source: ABdhPJw34SoD6VBESHQb58bU1aK+0WXAbQMV+2IacGIlx432dyWpr4sJnghQRfYmUIjJQ3JTW2VisA== X-Received: by 2002:a1c:4e08:: with SMTP id g8mr2990382wmh.116.1629201910786; Tue, 17 Aug 2021 05:05:10 -0700 (PDT) Received: from lin-dev-002.ipa.internal.netduma.com ([77.95.36.54]) by smtp.gmail.com with ESMTPSA id z19sm2328711wma.0.2021.08.17.05.05.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Aug 2021 05:05:10 -0700 (PDT) From: adrian.frances@netduma.com To: openwrt-devel@lists.openwrt.org Cc: Adrian Frances <adrian.frances@netduma.com> Subject: [PATCH] ubusd: fix disconnection when sending invalid fd Date: Tue, 17 Aug 2021 13:04:51 +0100 Message-Id: <20210817120451.8718-1-adrian.frances@netduma.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210817_050513_088977_7E0FDDE2 X-CRM114-Status: UNSURE ( 9.38 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.7 (/) 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: Adrian Frances <adrian.frances@netduma.com> According to man 7 unix, sendmsg returns EBADF when sending an invalid file descriptor as ancillary data. The patch avois ubus disconnecting the client when EBADF is received for the mentioned case. Content analysis details: (0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:335 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.7 SPF_NEUTRAL SPF: sender does not match SPF record (neutral) -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List <openwrt-devel.lists.openwrt.org> List-Unsubscribe: <https://lists.openwrt.org/mailman/options/openwrt-devel>, <mailto:openwrt-devel-request@lists.openwrt.org?subject=unsubscribe> List-Archive: <http://lists.openwrt.org/pipermail/openwrt-devel/> List-Post: <mailto:openwrt-devel@lists.openwrt.org> List-Help: <mailto:openwrt-devel-request@lists.openwrt.org?subject=help> List-Subscribe: <https://lists.openwrt.org/mailman/listinfo/openwrt-devel>, <mailto:openwrt-devel-request@lists.openwrt.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "openwrt-devel" <openwrt-devel-bounces@lists.openwrt.org> Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org |
Series |
ubusd: fix disconnection when sending invalid fd
|
expand
|
diff --git a/ubusd_main.c b/ubusd_main.c index d454b1a..8a043b7 100644 --- a/ubusd_main.c +++ b/ubusd_main.c @@ -67,6 +67,12 @@ static void client_cb(struct uloop_fd *sock, unsigned int events) case EINTR: case EAGAIN: break; + case EBADF: + if(fcntl(sock->fd, F_GETFD) != -1) { + cl->txq_ofs = 0; + ubus_msg_dequeue(cl); + continue; + } default: goto disconnect; }