From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.215.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796035795; b=IuuEQnJe4BLTyFG5FppA20BtmTaklxMI7TUrCRLar2TOrEi3J3A28SIwRrxQpEPQaI8O EOeFTERPQC7i6lP48ejT/h+Qr/r8hIM21Ncw7wS5R1b7G00Fol0GmOBQBfSYop2X3BFPB W0XvWyIZ33qMI8qVxaUfXGZ67cZf0VmdijA59U3cJiuo0VsrHedJE2Fh+LCEwt6abt4SI sktN/LUjYQVXHBY829+Prh1IndmvKH+hDF0V2+ifyMuBy/b4cmP06sehxfdN4dFTFb7yS aZgud9FjAlvInq5Tt4iVAKgqPiawnsUX+Iuqt2ioLEDjb918XjXcvuvXsUbYIeBm+ew== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796035795; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-Id:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=r7A1xPT2f1Bd+zRqZ1fE9xEWJ2m1yrnJLkKtHf2jL6M=; b=17n+tGFaMHQP0kkFigJYL8CFfEwYpljn6zld/ieY5wvRd1yO3crnFwd4dSmuDbCjRvIg wv3Qyl1/NFcbzcn+CJRcIz3jdyzXe7hlggqYkUbQUcSr0wcf2dIE90CKRtwI/KDw/qAoc XUjqUJyNBtXL/YSL0miWSVlFI1Q+0vEL0ACw6wIFgXayXmMs4LcoRyJX/KaPTxy2vQ5y4 Hw8o0nRnFQrrfSJ92cxA8i5FJZCpkuFCWrEjl25PsuLUI6UyXRGK6LI+HEpVkBUioDfXn HS+ar2YQKGo77iuKx8ujxcaZUCrqlKJH2tmFuxwsDjlIaMKp4Fl7LOpVNer1le6op/g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=lyCINDGr; arc=none smtp.remote-ip=209.85.215.172 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8DED5606A320 for ; Mon, 30 Nov 2026 10:49:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8DED5606A320 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=lyCINDGr Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-cd62c570b5dso6750228a12.2 for ; Mon, 30 Nov 2026 02:49:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796035795; x=1796640595; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=r7A1xPT2f1Bd+zRqZ1fE9xEWJ2m1yrnJLkKtHf2jL6M=; b=lyCINDGrzhCkfw6mjhqNT0U86Q5Aut8rp0lHqWsJ1htlQzNxauu1coob7cLwzQsADp FLXkSFnHI8IN4+6Jyy8rYe4VdMstCBsiGax8zPSAiQob7Ticx8Ksf4rvAZ4LaNwb9Mwa 6akVYIZBm3Cu5M197mnJ/3fuv3TRA0ctAMTy972AHcp6uO4LDz0jacO8+b5tLz+rrQ1M X6Xve9cKB7rixzOl87OQkX4UF77LHcPe3w8CLWfVogELHezdbyHpPF35v0psG5fRnVsM o5p1X0TPP9FUcYwjk9+70mvHuOgDWB378P/VszeTI0KDypkoWpDNKmiCjRBODiY7SXLe wu0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796035795; x=1796640595; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=r7A1xPT2f1Bd+zRqZ1fE9xEWJ2m1yrnJLkKtHf2jL6M=; b=yS1f+gvMvdUf4sb7bSsp8o8TR6xAhmkzwLbtuQ4A2MmRa9743H5EoaS9pTT7SBNGv+ dyMxhhRSnNLRY3l8J9HlahQ9OiBUyhQeQz+sz2rUvrPd1ZYpYERDEYkPc/BMBLwfgO0/ 7irpCC5Lq0CsZ/yX78gxG0h8d827oygduqTbNimPMzMLZT5fRyRd70evWRF1UHv4MKKh O2/MFzIeD8rNBen14tlrS5rjEmbYSMLvsEmxxnfbgb9UnaZGEmGmVrO6RpNlEBL+69ej Hm7Gsl88Hq8Isb5e1FzdGEK9h4JecS5vuhnNqnUi3EBkZpCmDWE3+tDnKbHLxbnO5fYN 4YVA== X-Forwarded-Encrypted: i=1; AL+hErEbNCzJTMdZaihXQ6GxADeyRpZBrm5HDOFrrkd2MwYR6CjKIEew2UxdkDJznv23qApCJwFiG5E=@vger.kernel.org X-Gm-Message-State: APuU4Z8JiJTcPxjTRCFkIBP0Rd2iMc0KsjgbTUxReDB0D/DysmU7kURw vkFxUBkxvdT1KTX6bDuhyBWJHDuLBUW89C79enm0vAU/EgLdhYmhnIUg X-Gm-Gg: AZFdTZfo0wZAXHxLmwVNAd+mI9bB3c9cGu8bg4SeX15FMHVgC017sSSopbNolg6cHfO CbypG0/ustuh2gYJJXzcO+2SSvG7Gkl47sBl2o5w+Ecmm6xnU+kZ/3mYOnNuIFUUBLxa7RdzS/F ToSZJTN3LaKtD20XUPdQqRI7ZbfqJtGYHkGJ5ZyqI2Nb2m1WGszb5KlXFqr0KoXQMjQ223GsZ6I bFJHPkcm/qLhvdEzYvMUJZMDpQovO646hlgzIuYba4Syb/xSz5RRdcCyXOLeBJE9HTHibZ5N+LO dUfYhXZ7nKq8XmVtvaUtvt0NOmCbRJfvLQ4zSothb4X4huB2Bj7QgD4eXzzdWznzo5V+4KP9MoE 9fgNtYyxf91NAGVmHz7+0xZ/Y5sZKeWTCslh/dEWc/yUnfPjYMzGDGyBB/0I0+S8UZlyj2OduqT GO/pc2fLYGTg585dgzLFgM0cq99aPv4DthH5ZCDWK5o/Y98hKhXxDhKwmQZjFu6EeVZjRzaga3+ gXW7CGmTdsFMCtAaDxrrurXyb/tONeIvp9tHYGXJna57jlgzeMubOxvs/eGQ9v4Rl33jS9lVqbr L68RCO98YYA5hfOGnndmqm7sis5TV1QQSutmUsXJkBCxAZH6OxIobQ== X-Received: by 2002:a17:90b:2b46:b0:3ac:7f4c:a68c with SMTP id 98e67ed59e1d1-3b41cb0d0e2mr35756228a91.49.1796035794714; Mon, 30 Nov 2026 02:49:54 -0800 (PST) Received: from csl-conti-dell7858.ntu.edu.sg ([155.69.195.57]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b41ad46ef5sm52391623a91.8.2026.11.30.02.49.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 02:49:54 -0800 (PST) From: Maoyi Xie To: Clemens Ladisch , Takashi Sakamoto Cc: Jaroslav Kysela , Takashi Iwai , linux-sound@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v2 0/3] ALSA: bebob/oxfw: bound AV/C response walks to the response length Date: Mon, 30 Nov 2026 18:49:46 +0800 Message-Id: <20261130104949.2216908-1-maoyixie.tju@gmail.com> X-Mailer: git-send-email 2.34.1 X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The BeBoB and OXFW drivers walk three AV/C responses by counts that the device puts into the response. None of the walks is checked against the length of the response. A count that is too large reads past the response buffer, or later past a stored copy of the format. Each patch rejects such a response with -EIO. A complete response is handled as before. The formats in the Griffin FireWave dump at [1] pass the new check. I found no such dump of a BeBoB device. Found with a CodeQL-based static analysis tool that we are developing. Each case was reproduced in a userspace harness under AddressSanitizer. Not tested on hardware. Compile-tested with W=1 on next-20261116. I used an LLM to help write the harnesses and these patches. Changes in v2: - Patch 3 checks the length in snd_oxfw_stream_parse_format() instead of a new function, as Takashi Sakamoto suggested. The stored formats keep their length for the later calls. - Patches 1 and 2 are unchanged. v1: https://lore.kernel.org/all/20261125121238.1602172-1-maoyixie.tju@gmail.com/ [1] https://lore.kernel.org/all/543FD6AA.5080004@sakamocchi.jp/ Maoyi Xie (3): ALSA: bebob: bound the channel position walk to the response length ALSA: bebob: bound the stream format entries to the response length ALSA: oxfw: bound the stream format entries to the response length sound/firewire/bebob/bebob.h | 2 +- sound/firewire/bebob/bebob_command.c | 5 +-- sound/firewire/bebob/bebob_stream.c | 15 +++++++-- sound/firewire/oxfw/oxfw-pcm.c | 44 +++++++++++++++++++------ sound/firewire/oxfw/oxfw-proc.c | 6 ++-- sound/firewire/oxfw/oxfw-stream.c | 48 +++++++++++++++++++++------- sound/firewire/oxfw/oxfw.h | 3 ++ 7 files changed, 95 insertions(+), 28 deletions(-) -- 2.34.1