Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp255187rwe; Wed, 31 Aug 2022 21:21:38 -0700 (PDT) X-Google-Smtp-Source: AA6agR6dxAozsrsRK2Mr9e0Or8SqBRmhCkq2uvaxqSkQkpESQu+6Zn4E8QX+1yH4GH/s2i/Vi789 X-Received: by 2002:a05:6402:3509:b0:43e:d80b:44a8 with SMTP id b9-20020a056402350900b0043ed80b44a8mr27750122edd.255.1662006097887; Wed, 31 Aug 2022 21:21:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662006097; cv=none; d=google.com; s=arc-20160816; b=uPRe/WE/l2JVPVoaQn2KdmTT4Vv6V2nBAtdn9ALSvxl/YiNBZhRX43uW/+bfFXlYQA fH/t1qE4MkzXNrNFrRMShD/MGGGrg9uQ0obQahswTCGV64/BsSYlye9pjJAV/eASOkYu bn5MhXQdQmw/aQQM6WSk9r1fr6L0Zsj3sQHDAXE/rbcIm/8FtUUcmr+3jzj6Dw7i/5Y6 ZpRDWSPW08DhtGNrM+j/gUnkgqNO9ZKU+dizDTleqgWe3OfqP7ZEaHZhO7n07Ux000sq YbeA+oF5OGKNZeHmhIUUHfh4BZVfuD67MGolU7mEtLAxN5MKFXm5fyxlj7IzVs8ZRrcZ KVyg== 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; bh=iZGfUbfPMzJ8eeXZKiiSQVTRV8VcBld+1Bipd5RKb5w=; b=cB8Am+JFQ9Lla51gVKwb6H3Ki2VPCDJ7gK+kQJyp+7QBhV65ZrMCNiC/wRZ92h+GhQ njAGTzAjLvcUBDVcjO9kVT0WuBeKSXLGDn8ZdSf8bZoNsy++VGiHfgmXB91xgY4am0+l 2XS9/9TDXE89mM63mjA5+MJFVAiZtHJwT3fQ0yNu5qQtpwI6Ez/VcmqtyMxGa06oVvTf p/F/F9oHX4qcm0T4JydZlaRaWJwJslNFaGdEH05vBUNkBktrJWoPrs0v2i6d+yzY+GBO 8IRMeYfsZD+hFFAZZjvuUFm5drA5oo4Jz+r9hwGnwV4s4BM1cPcxhEbXqn36h3OdD7Sq VV1Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g6-20020a50ee06000000b00447fb63e27dsi776771eds.348.2022.08.31.21.21.05; Wed, 31 Aug 2022 21:21:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232585AbiIAETK (ORCPT + 99 others); Thu, 1 Sep 2022 00:19:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232608AbiIAESN (ORCPT ); Thu, 1 Sep 2022 00:18:13 -0400 Received: from fornost.hmeau.com (helcar.hmeau.com [216.24.177.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B009E162160; Wed, 31 Aug 2022 21:18:07 -0700 (PDT) Received: from gwarestrin.arnor.me.apana.org.au ([192.168.103.7]) by fornost.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1oTbeR-00HQMa-Dn; Thu, 01 Sep 2022 14:18:00 +1000 Received: by gwarestrin.arnor.me.apana.org.au (sSMTP sendmail emulation); Thu, 01 Sep 2022 12:17:59 +0800 Date: Thu, 1 Sep 2022 12:17:59 +0800 From: Herbert Xu To: Khalid Masum Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, Steffen Klassert , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel-mentees@lists.linuxfoundation.org, Shuah Khan , syzbot+5ec9bb042ddfe9644773@syzkaller.appspotmail.com Subject: Re: [PATCH v3] xfrm: Update ipcomp_scratches with NULL if not allocated Message-ID: References: <00000000000092839d0581fd74ad@google.com> <20220901040307.4674-1-khalid.masum.92@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220901040307.4674-1-khalid.masum.92@gmail.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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-kernel@vger.kernel.org On Thu, Sep 01, 2022 at 10:03:07AM +0600, Khalid Masum wrote: > > diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c > index cb40ff0ff28d..3774d07c5819 100644 > --- a/net/xfrm/xfrm_ipcomp.c > +++ b/net/xfrm/xfrm_ipcomp.c > @@ -203,6 +203,7 @@ static void ipcomp_free_scratches(void) > vfree(*per_cpu_ptr(scratches, i)); > > free_percpu(scratches); > + ipcomp_scratches = NULL; > } Good catch! This is probably the root cause of all the crashes. > static void * __percpu *ipcomp_alloc_scratches(void) > @@ -215,7 +216,7 @@ static void * __percpu *ipcomp_alloc_scratches(void) > > scratches = alloc_percpu(void *); > if (!scratches) > - return NULL; > + return ipcomp_scratches = NULL; This is unnecessary as with your first hunk, ipcomp_scratches is guaranteed to be NULL. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt