Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp547759rdb; Tue, 23 Jan 2024 07:29:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IHZdbPpYCWsatMWWV12bi6OcGSUxJ2ObuaJbOwUjRO9mhU3wDjkzzQiENBy6XJGh8I0HLoM X-Received: by 2002:a17:906:c78c:b0:a2f:617b:f8a4 with SMTP id cw12-20020a170906c78c00b00a2f617bf8a4mr26983ejb.19.1706023742059; Tue, 23 Jan 2024 07:29:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706023742; cv=pass; d=google.com; s=arc-20160816; b=nOdirQuvkqE6rHSDqPOgaOB4cJ5hT2I1tftK98e3W84k64sCKygEznyNKvQk/Pl1ke kMHveoVx+fDbExEuNrEEjc6vBN+sq3R1Ygl4HvJ5JCKqIMjEZmD76fcCR49WePjedGqc J8tjKu/ifacfMHNodPSu9gtyBIY6/BNJ0vJ/+C/c6dDazKW7ZeuPVwHS34KB76MdDAzA NnPrYAm+VQ3EAyx18MEIp3aHvM+ot0xayzMKuSJ4h9lOHE5qIvNBrp6xurTmjR1Sepll QbLmuH0YC1j5KJyfY8TdbkIe6hHoftBzdU6Ee41DKbYxCr04XWERnSI8YbyIu8Dnk2vc zUCg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:to:from :dkim-signature; bh=Qs/2ZF6jfLSaibnI8JVEJM3hBakFXvbs64Vo+kN0Wno=; fh=4lGQI6056MBa4/oovMyIYaKLn+Wz/24RGvUivMmQP8E=; b=FHz25M4cCs8FQPt9KAVNrV0sIK4XBx579KtcaL5U/eMXBvt4byctarAr/gcuPmULNM fTdPGfnAkm9a1hLe1yYYVPd6WaTAakLg9DjXpoNyibZfsgXRAg4iRWNTRhAaVU5Xhv7Q rxR0Qd3KIH2+0aHM27TLPgz37O+3CqxQP5E5qiv4jdyMPfdPWN02uizSihA5leBwT9uN EP7eTaEVdfY9oroWIRpAKt5mG4FnGFHck/L6vPEsL4ApD2B57PsuB66+XfZPrukoZmCF 25uhPxWbi60PKwecZ9D2SlRsMi4MW7hZHF78movYndcbV1zKkFXuQzpNwkYX7gG0dPIk Rbig== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=SoBcDfFR; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-1273-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1273-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a5-20020a1709063e8500b00a2a8b469164si11676996ejj.1034.2024.01.23.07.29.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 07:29:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-1273-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=SoBcDfFR; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-1273-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1273-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id CA86A1F236F1 for ; Tue, 23 Jan 2024 15:29:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 62E595FDCC; Tue, 23 Jan 2024 15:28:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SoBcDfFR" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail-yw1-f181.google.com (mail-yw1-f181.google.com [209.85.128.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DD9D5FDB9 for ; Tue, 23 Jan 2024 15:28:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706023734; cv=none; b=Xv7ApuA4nNA/6ptOu04cSnE8FrHefS+5SaNerV/ZptL9sEbF13st/hkdlurIXaWK0ewpAFJD5IW0R+ufaNg8cLIajToX/xi+NNzbJ4Pp3bZctsVF7cK5kh1+n1topk488NsfiAFuLeaKLLTt5uer4zXoaG7WYRIr7jsiiGmkGoA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706023734; c=relaxed/simple; bh=Hz/sQTkal72CIicSJ3PgwnCpkwcm7R8/SSPoezeooQA=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=JQ+I8fy4VVjy9fH44/5M6tHM5bGtuK7G5G77WSdYVyl6cF4RRNHtKFLNc3DTFID6b3jEFgeIsdaOGWjRkUcSm8AxCyjjOvsVETm213FvGWLS1EJknDXSJ2nPyKZ4PIyAlz4wqwv+HzzHLy8FVkjph4yvZ6VYR6FBnI2ZmEVV0jg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SoBcDfFR; arc=none smtp.client-ip=209.85.128.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yw1-f181.google.com with SMTP id 00721157ae682-5ffa694d8e5so30508037b3.0 for ; Tue, 23 Jan 2024 07:28:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706023732; x=1706628532; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=Qs/2ZF6jfLSaibnI8JVEJM3hBakFXvbs64Vo+kN0Wno=; b=SoBcDfFRTTkd0X4nCuckMa8mKgHZoX9J9iXbc0DxoGKMWMVCOXGTx/CQlU5l3ScgcR qZnHhI1+7vPSAzCNwVkIcJLNCirPqmYL3mJ3H4XywgR6ErieyqNVKgdSp0u4MEs0g1Vc /2F7ZEykPXY7Sg/2wCINewyNNP5tyrxjH18DlPiBXQYydzBTJncFsOLly5qQnHsz0gok ApV2vhF1TWY1QHVjMl5WPmurKn6mJwCmsj2R1u//IHX7vzhRnXzwGz5K5OFIG3/ugwuP vcXscosu0OhViYGzEJ5tYqbqK3cM3F9NQWhuh5x1GIvOcNZn24j2E2VSXM2LRK9FkbZV ARyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706023732; x=1706628532; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Qs/2ZF6jfLSaibnI8JVEJM3hBakFXvbs64Vo+kN0Wno=; b=a85Enn5jeAvMcisUCu/NMGEwaf7WBm+GoXXyQU33iRPdoVhLj7CPvWC8kTcGrRaZVh pTuLhKNIDmRhC5E7fK9j0tv8G3TjrrYJTUiyukSwQjEq0egwKzRJK3Avntkvekmdwbbg Rq+LhLu1kBOgUscuottDjwhJg27yXAvWHP08DjJ6S+h+qQjQ3v6xfFJAVmLpeSXHCMt8 /IMiHJ2wvNnXPpPvS1+Kzos1bgNlyqkhf+KrNJo6HdeVWVgKnWTf2MZw86awJcHm0Goi aH5PgzD0PeatYMDWvdGCQDGTeQXI5rYQGc9L+V/TCpuZKyig0ZUQgOUgh6wqjFWMTBps N0UQ== X-Gm-Message-State: AOJu0Yy6joBiuqG5FmWAlbAg17cEou57DyEStQkF970iSDNdBbg2rHIs MaAic7vi3RA1Tig2Bjl39DIMXgIdWVXv3NHunZv6ssffCgY520wbgzshFHgQ X-Received: by 2002:a0d:d606:0:b0:5ff:ceed:10c7 with SMTP id y6-20020a0dd606000000b005ffceed10c7mr2387996ywd.0.1706023731860; Tue, 23 Jan 2024 07:28:51 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id l191-20020a0de2c8000000b005ff9d3ca38fsm3203108ywe.1.2024.01.23.07.28.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 07:28:50 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v1] isotest: Fix not handling 0 length packets Date: Tue, 23 Jan 2024 10:28:50 -0500 Message-ID: <20240123152850.2880226-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Luiz Augusto von Dentz It is in fact possible to receive 0 length packets since that probably means their status is not sucess. --- tools/isotest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/isotest.c b/tools/isotest.c index 771d24b6d2a6..7e875fa58b15 100644 --- a/tools/isotest.c +++ b/tools/isotest.c @@ -642,7 +642,7 @@ static void dump_mode(int fd, int sk, char *peer) } syslog(LOG_INFO, "Receiving ..."); - while ((len = read(sk, buf, data_size)) > 0) { + while ((len = read(sk, buf, data_size)) >= 0) { if (fd >= 0) { len = write(fd, buf, len); if (len < 0) { @@ -680,7 +680,7 @@ static void recv_mode(int fd, int sk, char *peer) int r; r = recv(sk, buf, data_size, 0); - if (r <= 0) { + if (r < 0) { if (r < 0) syslog(LOG_ERR, "Read failed: %s (%d)", strerror(errno), errno); -- 2.43.0