Received: by 10.213.65.68 with SMTP id h4csp643997imn; Fri, 6 Apr 2018 06:40:14 -0700 (PDT) X-Google-Smtp-Source: AIpwx486z/xOy5UVA9Q6iWtW8haosIM+1LHmHOcKiTsT1WC+kbvtTPAZhi8bdeepnm+JrvS/bkz5 X-Received: by 10.99.113.2 with SMTP id m2mr17775758pgc.34.1523022014934; Fri, 06 Apr 2018 06:40:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523022014; cv=none; d=google.com; s=arc-20160816; b=GLfQcGpFhF8IPZEfMhkwWArlptE2XpNs0/WTMPl61RLjRFSYyax3CHEnwvAx4hLUur /Sne/6qEMhU5AVnJ4yhIYkTxD0e4xY8oGmAmzQ/hgh2WtHB1uJezxAcS21DD3j0glnC7 +Aa1VuugOYgHmJ0gLY6ORBrN0XE3BHSObhdQKapDlxqgkYrT/tydZF9Mbxl8UkdJ2fUT hwP4OifE1OzFX4Vbvm5wEbmInn2fMLCkRRBbzJq3+HQ0jADVCKrGTNA4cNX/QxPk+itg dHhYZD+w2FqUcvK7+nZc6ASOKFaomZ9Fy1+pU1lbSRpqy0a2PJdGBbcJzvBRwNmP8nkt EHtw== 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:message-id:date:subject:cc:to:from :arc-authentication-results; bh=ERIzokCL13LdLyvBTPTVnYUe2EMWPfluFRtoS119IvI=; b=FJttOaiXxTLrFDWajX/acWhv8+8CgJpGDyEUVldDvZh/miNCTdlBw8gIMlwnhub5TL YzpYx9oyMLncOBqq0lrxZX+Wh1MtrOhwh9kNSCXgWFz0bYiWfs29knBamCBi3SQEQybv OKnPUBqz4F7F70BjbxCL43CX0Teom8pip9vVoydIyW6MTaCbV20Qrah13oAS7CahMUF1 9EJZ3qAfqx4OOkElbYzEjIkBnhnx6J+bIHYWWm2Mr5vbRYcrcf8BJF/FEEBprvDWPbzp +Q+XKv9nciJla4wOlW1xPcfCy8kfNUzT3+s5qA4AnQWimh8qgpag+RERHZOklH7tlQsn hP+A== 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 p68si7138290pga.751.2018.04.06.06.40.01; Fri, 06 Apr 2018 06:40:14 -0700 (PDT) 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 S932523AbeDFNiz (ORCPT + 99 others); Fri, 6 Apr 2018 09:38:55 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33794 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754928AbeDFNiv (ORCPT ); Fri, 6 Apr 2018 09:38:51 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id E9128D56; Fri, 6 Apr 2018 13:38:50 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Roese , Takashi Iwai Subject: [PATCH 4.14 08/67] ALSA: pcm: Use dma_bytes as size parameter in dma_mmap_coherent() Date: Fri, 6 Apr 2018 15:23:38 +0200 Message-Id: <20180406084342.408242968@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180406084341.225558262@linuxfoundation.org> References: <20180406084341.225558262@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stefan Roese commit 9066ae7ff5d89c0b5daa271e2d573540097a94fa upstream. When trying to use the driver (e.g. aplay *.wav), the 4MiB DMA buffer will get mmapp'ed in 16KiB chunks. But this fails with the 2nd 16KiB area, as the page offset is outside of the VMA range (size), which is currently used as size parameter in snd_pcm_lib_default_mmap(). By using the DMA buffer size (dma_bytes) instead, the complete DMA buffer can be mmapp'ed and the issue is fixed. This issue was detected on an ARM platform (TI AM57xx) using the RME HDSP MADI PCIe soundcard. Fixes: 657b1989dacf ("ALSA: pcm - Use dma_mmap_coherent() if available") Signed-off-by: Stefan Roese Cc: Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/core/pcm_native.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -3424,7 +3424,7 @@ int snd_pcm_lib_default_mmap(struct snd_ area, substream->runtime->dma_area, substream->runtime->dma_addr, - area->vm_end - area->vm_start); + substream->runtime->dma_bytes); #endif /* CONFIG_X86 */ /* mmap with fault handler */ area->vm_ops = &snd_pcm_vm_ops_data_fault;