Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp3690436ybx; Mon, 4 Nov 2019 01:06:51 -0800 (PST) X-Google-Smtp-Source: APXvYqwIHZdD8QLEhlyikuUhFcPIc5C2ulcIJRgArqn4/xHFLgJ+T9F4Ek1Y6CjksWXzMjc8I3lt X-Received: by 2002:aa7:d0c1:: with SMTP id u1mr5598664edo.27.1572858411473; Mon, 04 Nov 2019 01:06:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572858411; cv=none; d=google.com; s=arc-20160816; b=FvES7g/wUi9dJI+74jR8wQY1hJ2PZd0d/AbhUy2yaFrEBeMwg/0+VcETjUqUUru7e2 1NhFgtirt6NjD5JUFZzNrigwvo1cYQQAQr0ZxYgnsQTwRIG9AG0rdfHSlm663rrM9Sui Q8l2SA7gFvplRB3KAlHaold6Jo1EQ050yzbz0wFp+V3fD03C7zZUcj+uyUqqPys/BzKO 461+5maP1+YrFQapbQ4gpA/oXxvi60iC2begyMexeHNnqQW+QOCWi42sZL739M61JeUy DP5N59uYg/4SmrijAiHdbBf6Kt1I1ZundyfSmaD64lIYlzHHW0qANtuCbqeofmpeVAMx pJSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date; bh=cExAbI/wJKZT5CO8kgvym0BNHsq7sDqJGwGonX1rIMo=; b=uMJ3sYzkIQSgrfZmUpQBu8PORaZiqMlvzafZpvQxTRnVNQuiB+UmbR29i3WdkFPKpt 3LcVz+QjVpgy5FCVHTxz/028H6ob5g0ij60y7scDrIYhnx8kNkuy9BB4qnXRw8W5fENp 8HKtN6+PH90dbwNIE+Of7nUOUad/FyOJjfNDK2g45+eGcuuJwpi2Np5g/wPZI88/fDS3 QHHJX4I3lHPt1z7qIBqGdsRLJEVkkoqHAk+ADLXZ8kPI/ZdncUItvJ6j0Y7Cjc8O1TXj s+X8Ctcpli5UfKgnp0WHybPfLbZXts9xsTHosX3jtPX/TaG1AOvFGn5Nt/Mrlh1pyzur cYOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l27si7074629edc.358.2019.11.04.01.06.27; Mon, 04 Nov 2019 01:06:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728365AbfKDJDj (ORCPT + 99 others); Mon, 4 Nov 2019 04:03:39 -0500 Received: from mx2.suse.de ([195.135.220.15]:58142 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726633AbfKDJDj (ORCPT ); Mon, 4 Nov 2019 04:03:39 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id E0C8AB4CD; Mon, 4 Nov 2019 09:03:36 +0000 (UTC) Date: Mon, 04 Nov 2019 10:03:34 +0100 Message-ID: From: Takashi Iwai To: Greg Kroah-Hartman Cc: youling 257 , Takashi Iwai , linux-xtensa@linux-xtensa.org, Michal Simek , Vladimir Murzin , linux-parisc@vger.kernel.org, linux-sh@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Helge Deller , x86@kernel.org, Linux Kernel Mailing List , linux-m68k@lists.linux-m68k.org, Robin Murphy , linux-arm-kernel@lists.infradead.org, hch@lst.de Subject: Re: ALSA: pcm: use dma_can_mmap() to check if a device supports dma_mmap_* In-Reply-To: <19c3f0ca-9b21-0c5e-894d-976594f38a86@google.com> References: <60ee349a-1fe7-46f0-5161-1dcfcb6fbee9@google.com> <19c3f0ca-9b21-0c5e-894d-976594f38a86@google.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 04 Nov 2019 09:49:43 +0100, Greg Kroah-Hartman wrote: > > On 11/4/19 9:32 AM, Greg Kroah-Hartman wrote: > > On 11/4/19 9:27 AM, youling 257 wrote: > > > This driver > > > https://android.googlesource.com/kernel/common/+/refs/heads/android-mainline/drivers/usb/gadget/function/f_audio_source.c > > > > > > > > > > The driver is broken and needs to be fixed. Please feel free to submit > > patches to AOSP to do so as you can trigger this easily. > > Hm, maybe the driver isn't broken... It is :) > snd_pcm_lib_preallocate_pages_for_all() is called with > SNDRV_DMA_TYPE_DEV set, so that should be fine, That's the cause. It passes NULL to the device object, which is incorrect in anyway. I guess this used to work casually just because x86 accepts the NULL device object as if an ISA device. > and the only other > buffer I can see allocate here is with a call to > snd_pcm_lib_alloc_vmalloc_buffer() which _should_ be ok, right? If the driver allocates the buffer via vmalloc (and the snd_* helper), it shouldn't do preallocate in that way. That is, the correct fix would be simply to drop snd_pcm_lib_preallocate_pages_for_all() call from the driver code. Also, a quick skimming showed that the driver needs to set snd_pcm_lib_get_vmalloc_page to the snd_pcm_ops.page ops. > I don't see any buffers coming off the stack here, unless the gadget > controller is the one creating them? That's the code before actually allocating the buffer itself. It checks the availability of mmap support on the architecture, and the helper code assumed a proper device object passed there via the preallocation helper. thanks, Takashi