From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751347AbdEaPMm (ORCPT ); Wed, 31 May 2017 11:12:42 -0400 Received: from www.zeus03.de ([194.117.254.33]:39060 "EHLO mail.zeus03.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751246AbdEaPMl (ORCPT ); Wed, 31 May 2017 11:12:41 -0400 Date: Wed, 31 May 2017 17:12:37 +0200 From: Wolfram Sang To: Vignesh R Cc: Florian Fainelli , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Felipe Balbi , Peter Chen , Roger Quadros , Alan Stern , Mathias Nyman , Javier Martinez Canillas , Baoyou Xie , Sekhar Nori , William wu , Arnd Bergmann , Chris Bainbridge , Wolfram Sang , Krzysztof Opasiak , Felix =?utf-8?Q?H=C3=A4dicke?= , Colin Ian King , "open list:USB SUBSYSTEM" , clemens@ladisch.de, maksim.salau@gmail.com Subject: Re: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity Message-ID: <20170531151237.GA2399@katana> References: <20170426005612.24850-1-f.fainelli@gmail.com> <84087586-d5fc-3115-4b16-93c75e411c59@gmail.com> <20170528160330.xjseehf6nnoooe75@ninjato> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="+QahgC5+KEYLbs62" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --+QahgC5+KEYLbs62 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > > +/* only works in process context because of stack detection */ > > +static inline bool is_dma_capable_addr(void *addr) > > +{ > > + return !(is_vmalloc_or_module_addr(addr) || > > + object_is_on_stack(addr)); >=20 > This does not catch kmap'ed buffers which are not directly DMA'able. > I would suggest to use virt_addr_valid() instead. Something like: >=20 > return (virt_addr_valid(addr) && !object_is_on_stack(addr)); Hehe, here is the part of the commit message I have for this code: =3D=3D=3D Second note: I am not even sure the checks complete (kmapped mem?). But that just strengthens the argument of having on centralized place IMO :) =3D=3D=3D So, thanks for the heads up! --+QahgC5+KEYLbs62 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAlku3WAACgkQFA3kzBSg KbZ8mg/+NIr7J97OzcCW2ZJzl2D0whvxdv5z2avBgAZTopSHVb36NeMrYLGBVMhj f9aS+TgdHKfmIQ9oPgDk8HmPVah5rYWOiSbUxD1dNAkaB09nbd24225dpVmbL+zN e1vOn0mmWU3imz8rLsAPjxq+Y8UPLrCVlF7zJUVT1yaSPodylbDE20F3VxcjFD5D XLQGCHT8gZ1u5Ajotp3a2aipsljdih7PGKNffCexMbiz4sODfwUeUJa7v3KthOXZ PLlHuQ+Jq5F9F3c8xzwhYpvVLcfioMO7CXW1vT3vXY5o4IYQo2kWKfHxJu3IqSia GJ+v409CGtopKhOBqJvsSu9W+n7g7bRzYK5+2/BPXblIvK3GITRFXdw/p8XmgF6L beSrfsG6hWXjvWwHq5343ZEHSrKnMIZuJu/MJK+34kmpztEBr8eIRdlnWyY087fh OmXyz0DdrNzP+u8KoVG7C8fNds3HisxUzrCOXl3GYhLzzwCC+h8M3PnaSa2BsjZS MTaEBA+EDyaT/qqyYGNRSwpvtm2+Ltq/iaTy1w74DWd8OvxC0tSL3nwYLEe0Z8x3 BawfmQsgsSpH1Uf2oek1MPnedsvBJK77s5L2C68e4b+X4wamwdvZoh+deIiE+dx1 43XykGZA/PZSaFcXbvs7B44xQmd2yvKMbUwsO0/y4g/tcohixJQ= =sfKm -----END PGP SIGNATURE----- --+QahgC5+KEYLbs62--