From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C26BC04A6A for ; Wed, 9 Aug 2023 14:15:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233205AbjHIOPu (ORCPT ); Wed, 9 Aug 2023 10:15:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233208AbjHIOPr (ORCPT ); Wed, 9 Aug 2023 10:15:47 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACE571FCC; Wed, 9 Aug 2023 07:15:46 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 822116732D; Wed, 9 Aug 2023 16:15:42 +0200 (CEST) Date: Wed, 9 Aug 2023 16:15:42 +0200 From: hch To: Stephan Wurm Cc: hch , Richard Weinberger , linux-block , Miquel Raynal , Vignesh Raghavendra , linux-mtd , linux-kernel , Johannes Eigner Subject: Re: ubiblock: null pointer dereference using scatterlist in work_queue Message-ID: <20230809141542.GA32614@lst.de> References: <1293911429.1782934.1691445776353.JavaMail.zimbra@nod.at> <20230809135308.GA32214@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 09, 2023 at 04:10:59PM +0200, Stephan Wurm wrote: > Am 09. Aug 15:53 hat hch geschrieben: > > Well, a scatterlist culd contain a highmem page, in which case sg_virt > > isn't going to cut it and you need to kmap. Is this a 32-bit system > > with highmem enabled? > I can confirm it is a 32-bit system with highmem enabled. Yes. So the code needs to stop using sg_virt to work on highmem setups and do the equivalent of scsi_kmap_atomic_sg. Best way forward is probably to move scsi_kmap_atomic_sg to lib/scatterlist.c (and also convert it to kmap_local instead of kmap_atomic while you're at it) and then use that in ubiblock