Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4800768iob; Mon, 9 May 2022 01:49:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxYAlxtx+GUIrlSirfIvt32/iKj3bphdlMOlbEo8LRa6Qbb+/xrOpPcqaN8NHjuavt6WXK X-Received: by 2002:a63:d90c:0:b0:3c6:4ab4:fbfe with SMTP id r12-20020a63d90c000000b003c64ab4fbfemr11858914pgg.499.1652086160603; Mon, 09 May 2022 01:49:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652086160; cv=none; d=google.com; s=arc-20160816; b=SNBcLEyaRTyjNt24lgJqVe8JB0a6ROLttwcyURJNC51KWaD3N0ZP6sEr6PPwEt/gvg dvk+xAz6TXPyL0jiZRqSTBTaaH22v//i/UCCkq6AXrqhNbEfBx9TnhWQjJVsqP+X3sBs cTPs96eA65zK4FttHUaGs+NFnL91sv8BLFN60FTXY0tsnO2QXdmZy8l5sN2o/VGGy2yt KWTMm6+okyRkumyVQhw6Og0OE7eBcCX9IcI2+//9xgmtfnSOmWdajnSpfFQj56zqMfNM 99/j4kbr3k6aGT/4kdiHaE1XkLEriDJVMOlEUM/ETUYlm/nDomRYS8Eg4H5edXlZtK7X L2Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=pH/8q4WWU1F57uoZuiEXN9uHXlw/jrDUSuY49/KnKJw=; b=G1lAnXtRpsNWUJ4htNWYBkQjyK67iKh0J0bsABOl3+VupfToJWxRilSLsfWGIe1jDn Fe/bk/OSM9NZY0aj8KIdm6rzTuhCpkUBciF4m12uXNJtMzVD3iG6NbKVYCCXKmpEHTCB rpQguaDa7zVPEz098MB7tGb2J1Jfwd62+2/I+gYdpe1erXG2EXAZOdBgdY5LscrkoFlA Ki7dtFCaSMjfkw4xHVUgMOWRukA2+WHik6Bwma8B8Ybj7Hl1mLXbeX74s/NRR5WG7q24 jJXgFCIWx0yMO5RJciEOO1NlKjxgwE+9uva2BmaQHhLIcb4sSeCH44ldHkBHdKsnJQhb oAmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XnlBjqlN; spf=softfail (google.com: domain of transitioning linux-crypto-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id p19-20020a17090adf9300b001bd14e01fb8si18564739pjv.166.2022.05.09.01.49.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 01:49:20 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-crypto-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XnlBjqlN; spf=softfail (google.com: domain of transitioning linux-crypto-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F06FA11030F; Mon, 9 May 2022 01:34:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383752AbiEGIpf (ORCPT + 99 others); Sat, 7 May 2022 04:45:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383733AbiEGIpe (ORCPT ); Sat, 7 May 2022 04:45:34 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C86093F304 for ; Sat, 7 May 2022 01:41:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651912907; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pH/8q4WWU1F57uoZuiEXN9uHXlw/jrDUSuY49/KnKJw=; b=XnlBjqlNMMhQWursFY6HaANegJABInZXYtHnLusS/w38WdKjUdO/sftkkMVIYkJ+0gWijt TGJpUPv7dAWjTnBmiq88QRFZEDw0esipV7NLFtGa996X31kB9ajnU8WtkFoOdL9eBFVON+ AKiQWkgU9NwAE0EMw0rRq0TzZberYuU= Received: from mail-yb1-f198.google.com (mail-yb1-f198.google.com [209.85.219.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-583-IyRHl51iNSmzypx0h1FHww-1; Sat, 07 May 2022 04:41:45 -0400 X-MC-Unique: IyRHl51iNSmzypx0h1FHww-1 Received: by mail-yb1-f198.google.com with SMTP id z14-20020a5b0b0e000000b0064848b628cfso8163064ybp.0 for ; Sat, 07 May 2022 01:41:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pH/8q4WWU1F57uoZuiEXN9uHXlw/jrDUSuY49/KnKJw=; b=5gjWT5Aw3lsTJ4x32SbzCFjeO5U0PckcKT4f9IbptjO/1nbYQp/yUdgXDqqUKOccMV Z+Z6/z0mkDEZsQsoGeDcvFg5UdPyNf7b5PAz1eM/Az/LxHg8gRgLIWCfxMvgCctLSni0 VAtOAOb/jav8mjS6BU1noUIr/cTnu5QXhkiqIWo3EkaTJO/6wMfYjz6U6o9lCW469U32 nMPvfKy6pEx7ORGOLBUuyDyrdPg7GiK3Hk26vo0ka7NQ+IArHOrbKcY6hM5tmqdXnjJJ t3jvFM71wyfC2/0PiFZUH8cSpYMA2k27kVQ0Z/TJ9j0HaFlxNpYw4NnpfdNpiBReuMuz owYQ== X-Gm-Message-State: AOAM532wDlxReEZRo0lJ4d91VKmZR6oXi9tMAbkZ4GYVDLQpwP0F7J1d 0/WtMMfVuqat1rXx3aSq2v8C5e6Xkvx0525KbJoX/kSuwSkO/LncgIEvHtON3hoszPidp/wbElr qpN36Nc4Y8ASsGp02tDPLikxiNWzTKV+ftyXKRnM6 X-Received: by 2002:a25:d209:0:b0:648:370f:573c with SMTP id j9-20020a25d209000000b00648370f573cmr5570210ybg.255.1651912904428; Sat, 07 May 2022 01:41:44 -0700 (PDT) X-Received: by 2002:a25:d209:0:b0:648:370f:573c with SMTP id j9-20020a25d209000000b00648370f573cmr5570202ybg.255.1651912904261; Sat, 07 May 2022 01:41:44 -0700 (PDT) MIME-Version: 1.0 References: <20220503115010.1750296-1-omosnace@redhat.com> In-Reply-To: From: Ondrej Mosnacek Date: Sat, 7 May 2022 10:41:32 +0200 Message-ID: Subject: Re: [PATCH] crypto: qcom-rng - fix infinite loop on requests not multiple of WORD_SZ To: Brian Masney Cc: Andy Gross , Bjorn Andersson , Herbert Xu , "David S. Miller" , linux-arm-msm@vger.kernel.org, Linux Crypto Mailing List , Linux kernel mailing list , Linux Stable maillist Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Tue, May 3, 2022 at 6:11 PM Brian Masney wrote: > On Tue, May 03, 2022 at 01:50:10PM +0200, Ondrej Mosnacek wrote: > > The commit referenced in the Fixes tag removed the 'break' from the else > > branch in qcom_rng_read(), causing an infinite loop whenever 'max' is > > not a multiple of WORD_SZ. This can be reproduced e.g. by running: > > > > kcapi-rng -b 67 >/dev/null > > > > There are many ways to fix this without adding back the 'break', but > > they all seem more awkward than simply adding it back, so do just that. > > > > Tested on a machine with Qualcomm Amberwing processor. > > > > Fixes: a680b1832ced ("crypto: qcom-rng - ensure buffer for generate is completely filled") > > Cc: stable@vger.kernel.org > > Signed-off-by: Ondrej Mosnacek > > Reviewed-by: Brian Masney > > We should add '# 5.17+' to the end of the stable line. Is that really relied upon any more? AFAIK, the stable maintainer(s) already compute the target versions from the Fixes: tag. And the version based on the original commit would be inaccurate in many cases, as the commit may have been already backported to earlier streams and you need to patch those as well. Thus, I believe it's better to leave out the version hint and force people to look up the Fixes: commit instead, which is more reliable. Also if you grep the latest mainline commits for 'Cc: stable@vger.kernel.org', you'll see that most commits don't include the version hint any more. -- Ondrej Mosnacek Software Engineer, Linux Security - SELinux kernel Red Hat, Inc.