From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 7CA8A39A068 for ; Fri, 15 May 2026 06:52:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778827939; cv=none; b=L4xg+xsIj1gmgal75j0kM9/iJToZvVhJ3qslsva6oZXwhHYP7J1brZwy10cGizsorr/U/T9wo0sNPOuBgOulvKARxIo7F63GvnpQfIA05HYp6grsLKzKufG1BZpGnLX0kFzxSQbCEsvjBcTC+zu42xzG7sh657IDFO1NSSREaAA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778827939; c=relaxed/simple; bh=tWuUm2mwbcJ4rbivt2NwYTSnQNVNKTVRWkuENrADWPo=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=UxTvEz+FAezEQ6D2kVEmmqcgRpjxeHtdS/Y52HTCSNOdn9879Fz/4hiQF2aOsE/3ydG5VGc7SW2HoqQRTXuV8C2l7dY6mEdpctkhaopnJbotJiJm67GT7jqX1Fm4XxynQj/F6ceefalzX84N7sBAeFTjw6RXmy8N5n1qofjSnNI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=NIwxRL+u; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=cyqRQcKz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=NIwxRL+u; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=cyqRQcKz; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="NIwxRL+u"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="cyqRQcKz"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="NIwxRL+u"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="cyqRQcKz" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 smtp-out2.suse.de (Postfix) with ESMTPS id 84F9367684; Fri, 15 May 2026 06:52:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1778827936; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eW+AdS6SSgbLPMNBbL/0rBzhTfkZXvAnba8Rxn6lqoo=; b=NIwxRL+ubn76TL3bFNV4QSSMEcpxaOT2EoHZipa9X+y6YO+jU5HTo5uiJYNESgWEYV4UuZ W3dEgU0YdlZnqXkVrcCJbOtlwNuHkO0dUlFtLos3dNjNPBbZsrdqJqYpcnErYII3tpdkjh qCvPsgRrJxOaTz2w2mlGwKM3o+O98Js= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1778827936; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eW+AdS6SSgbLPMNBbL/0rBzhTfkZXvAnba8Rxn6lqoo=; b=cyqRQcKzV2SotHYrdy0wGop/HryCA5Pr+SeatEaliYB1QjdjkqPIYeHN65SZfxdKxmWxFd MOFbTa6ek8jcmrAQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=NIwxRL+u; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=cyqRQcKz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1778827936; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eW+AdS6SSgbLPMNBbL/0rBzhTfkZXvAnba8Rxn6lqoo=; b=NIwxRL+ubn76TL3bFNV4QSSMEcpxaOT2EoHZipa9X+y6YO+jU5HTo5uiJYNESgWEYV4UuZ W3dEgU0YdlZnqXkVrcCJbOtlwNuHkO0dUlFtLos3dNjNPBbZsrdqJqYpcnErYII3tpdkjh qCvPsgRrJxOaTz2w2mlGwKM3o+O98Js= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1778827936; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eW+AdS6SSgbLPMNBbL/0rBzhTfkZXvAnba8Rxn6lqoo=; b=cyqRQcKzV2SotHYrdy0wGop/HryCA5Pr+SeatEaliYB1QjdjkqPIYeHN65SZfxdKxmWxFd MOFbTa6ek8jcmrAQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 3BDB2593A9; Fri, 15 May 2026 06:52:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id NuM3DaDCBmqzTwAAD6G6ig (envelope-from ); Fri, 15 May 2026 06:52:16 +0000 Date: Fri, 15 May 2026 08:52:15 +0200 Message-ID: <87ecjdupuo.wl-tiwai@suse.de> From: Takashi Iwai To: =?ISO-8859-1?Q?C=E1ssio?= Gabriel Cc: Takashi Iwai , Greg Kroah-Hartman , Mark Brown , Wesley Cheng , Arnd Bergmann , Jaroslav Kysela , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH RESEND] ALSA: usb-audio: qcom: Check offload mapping failures In-Reply-To: <20260511-alsa-usb-qcom-offload-map-errors-v1-1-6502695e58bc@gmail.com> References: <20260511-alsa-usb-qcom-offload-map-errors-v1-1-6502695e58bc@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/30.2 Mule/6.0 Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Level: X-Rspamd-Action: no action X-Spamd-Result: default: False [-3.51 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; FREEMAIL_TO(0.00)[gmail.com]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_SEVEN(0.00)[10]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:mid,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Queue-Id: 84F9367684 X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spam-Flag: NO X-Spam-Score: -3.51 On Mon, 11 May 2026 06:36:37 +0200, Cássio Gabriel wrote: > > uaudio_transfer_buffer_setup() calls dma_get_sgtable() and then passes > the sg_table to uaudio_iommu_map_xfer_buf() without checking whether sg > table construction succeeded. If dma_get_sgtable() fails, the sg_table > contents are not valid. > > uaudio_iommu_map_pa() also ignores iommu_map() failures for the event and > transfer rings and still returns the allocated IOVA to the QMI response. > That can expose an unmapped IOVA to the audio DSP. For transfer rings, > the failed mapping also leaves the IOVA allocator state marked in use. > > Check both operations. Free the coherent transfer buffer when sg table > construction fails, free the sg table when transfer-buffer IOMMU mapping > fails, and release the transfer-ring IOVA if iommu_map() fails. Also > return the existing event-ring IOVA when the event ring is already mapped, > matching the pre-split helper behavior. > > Fixes: 326bbc348298 ("ALSA: usb-audio: qcom: Introduce QC USB SND offloading support") > Fixes: 44499ecb4f28 ("ALSA: usb: qcom: Fix false-positive address space check") > Cc: stable@vger.kernel.org > Signed-off-by: Cássio Gabriel Applied now. Thanks. Takashi