Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2312635pxb; Mon, 19 Apr 2021 02:40:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx11jaI3dmmXjAgHoeI00tKlctlFgErHlcdqtdAO0RuhoQtwl/Guy871dUs2ZkWF/evBujr X-Received: by 2002:a17:902:eec5:b029:ea:bffe:2b06 with SMTP id h5-20020a170902eec5b02900eabffe2b06mr23015650plb.8.1618825240299; Mon, 19 Apr 2021 02:40:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618825240; cv=none; d=google.com; s=arc-20160816; b=xNe6hOrBzwg1Pk/wpy1FnkigFMKuYVAhDBsZfeDl5VjceiCXr5XS2tk+3+dOYeAIRl NQhgwlMUnrKpDGDzHZVWS05blQEzOcCUcLooZ2MNtiaJZu317yy4yrFrYArHKNDQRfUX xlxWit+tT/JS32oAnY3vVfyWVbKdVb2/4XMeRwmgTh5SdVgwSYrKcem1w+OtQSHXJPys nAbYVOMcBF8BK7MTHvVHmVm02hnYgvjg/SKZaIPa3R0MPQsIEa4th2x/XlTWFFHkVwOP GWfoQ7bhVN14PPksEXut8ArEYZMbg7/GrC7JRA5ifKM+Y+9ZH20u4dosYn90BUGW70kP By2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=j1lU31rTZNG6wNmVz3ZQ8tSWhLi5TeccKCKD/Lh4VHs=; b=Wc7oY8J0AWRh7gAjQTGmbEmL42erKE2c8Dh4r+UW2nF43up1hxtEeAN7EfLEwy1w5K eOGmTvhX6qHodmPD2yaaY1nFGOYzPcNri76IRwKxWMoLn/URsDGVdl9+3Aq38uPtE9IV QWM1TUQL0j/QjB23ojajZqLXFFXrwGfJHebUeY2BmBKX9BOkYa5cyJLwQYO/IxRfq3FT hJpfQI7C/YOFgpa3ovctTq3Aii2YghdY9Hf75MB4+nyFPWeiPO4DENd7xHho8cBZHtrz KYBBqDiXeOQJCkjYOBsDcANYeYOnUskei7UDyt7SQeFgWbughWwqmWjLlWIamgwVeelm 3N1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="cDN/Socz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z21si16628058plo.8.2021.04.19.02.40.28; Mon, 19 Apr 2021 02:40:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="cDN/Socz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229848AbhDSJYI (ORCPT + 99 others); Mon, 19 Apr 2021 05:24:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238563AbhDSJYF (ORCPT ); Mon, 19 Apr 2021 05:24:05 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FEC3C06174A for ; Mon, 19 Apr 2021 02:23:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=j1lU31rTZNG6wNmVz3ZQ8tSWhLi5TeccKCKD/Lh4VHs=; b=cDN/SoczlYUPKOizKaUHTQ8DoZ RmB0WLXtZenIC2Yw/Efx6BfJ4QVRUr5Yw9WTESbMvTh18v6qu1PwGjmVXMATuCwVMZNhQdeZWj6+I XpckIV+t7yrUP+EWu/vGiQgpywJfngs1IrUITMAXAzQrabyLOB9qdGGp7ikTSO3Ok1OBsf1fvrQNr Kn9bFPjo2M1TOhDAUMKcoDssTjopgUHoKos8Fua5drsAwX9EWhBigo4wAl9tjF4qJXKfpVJt1OJad BYOqBgWNkoLujagE7YNVASkKHX7uhYWvyfij3jLFDQN8RLzz0kSdY171XudPdn4dwZwCuRZbkjP8W RIbrD6uQ==; Received: from hch by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lYQ7p-00DWID-Ms; Mon, 19 Apr 2021 09:23:28 +0000 Date: Mon, 19 Apr 2021 10:23:25 +0100 From: Christoph Hellwig To: Alexander Egorenkov Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] lib: scatterlist: Fix SGL length in sg_split() if !CONFIG_NEED_SG_DMA_LENGTH Message-ID: <20210419092325.GA3215674@infradead.org> References: <20210418081441.5040-1-egorenar-dev@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210418081441.5040-1-egorenar-dev@posteo.net> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 18, 2021 at 08:14:41AM +0000, Alexander Egorenkov wrote: > If CONFIG_NEED_SG_DMA_LENGTH is NOT enabled then sg_dma_len() is an alias > for the length field in a SGL. In that case sg_split() wrongly resets > the length of split SGLs to zero after it was set correctly before. Why is this routine messing with sg_dma_address and sg_dma_lensg_dma_lensg_dma_len at all? This whole sg_spli() routine seems rather dangerous because ownership and state of the DMA mapping is entirely unclear.