Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3476133rwd; Mon, 22 May 2023 14:35:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6CSNP3kaNr4P+wNux1UXRIh2mtih8OhwAqwl4zTpoaVvJ+OL6KhC+k9P2T0BDE4/H9RTDU X-Received: by 2002:a17:90b:4d8c:b0:253:3dd9:79e2 with SMTP id oj12-20020a17090b4d8c00b002533dd979e2mr11843840pjb.5.1684791308875; Mon, 22 May 2023 14:35:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684791308; cv=none; d=google.com; s=arc-20160816; b=lg4pQHH9GqeN4GmFAgqfBYKkDhLbDwk5EoqNEVxqzEwL2h8OqP/492hNZ3zOtI3FI6 anUvaSw8DK+Ap0WafW2MGOy69Q2MpQB4BdAj4vFT4H2ZlS0HORv1m4FkTX/d1Th5M0R9 hIlsIB0P6/VkpTfzgIMdHeKdq/J2pGdmnP+CsATxQHGiI0qgSUBpToBBXzZ1TndXuDiE CC0JJ+5Vq90C3iG3uSMqWVkIIADtUb5p7BEBd5rMrFvdXGCgGGjpLBfa9dmpBnpJzw0b nnsHW1MlRuJqnP9Dpnd+DwbRd5f6/UjQTQtXFvJtztkRc3y+e6iC39DF/rGH0JDwAd/O 3Gfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=o45skQCW05aoS9DI6od2cBGCBFOyyDBnDFRMJXiZwBM=; b=n40xAnHWmOdwiSnreWfppSK0Fx9KoCCrEh2qFuIZkL4mJ+oKnR+29pDxkyYWyxzw9/ K0r4dBNqzk/B6AxIeM25nkzHxGLqHmKIZmyBkQCf3csLOUI7D31XTdY6JUdgW/B9/8kx HnkfyIvDN9M9LnoFjqir1z2rLS4Ww5eBF9Vf8bC9tXYA9orXXN/B7bhhU5jovqobsbPI sdF7IFJFw4IPbiY2qF1U7R0HIQXDidu5MrydrsLZLxxKd6udwx7kok306Vd5Of4wCuME cPyZdA/ZuL8srESexKjNOeKFMGQ5/ik+Rkg1pmIxlLRPqAfnFrMZslGFoKrfLQvLgZWN Vn3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="4N/sUcZ9"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q1-20020a63ae01000000b0053076a4da8asi1184145pgf.770.2023.05.22.14.34.55; Mon, 22 May 2023 14:35:08 -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; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="4N/sUcZ9"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234229AbjEVVVt (ORCPT + 99 others); Mon, 22 May 2023 17:21:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233410AbjEVVVr (ORCPT ); Mon, 22 May 2023 17:21:47 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85F88C6; Mon, 22 May 2023 14:21:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=o45skQCW05aoS9DI6od2cBGCBFOyyDBnDFRMJXiZwBM=; b=4N/sUcZ9BUoADLYog1KHCCG9qq 1MmC0l7U7MMFm/pb/CMiCEGhHde5YvdPAClCnWx6m1AjjWqY1ZXKhjoINwzDcGKGDC0tsBFdRm9QK jTxHymltoxiw0ciU9pqQwK9wliQ9ZnW7lDDn4lY54MVMGvallddVj9/Hd7J73nf0RPH3b2vwME+GG BVhH02LYW+hYeukDo6BnRrtnvDEnfQBxHVg7Sy2fSS+FgOoHfqPl3vhHtPA4sPnL7z+WIutCS+6K2 O43+3k6ZX/ZvGJpcoqlzWY1W2eiWEzKqIXnvhPwuT2UxM+8U+ylxCXGLrd/KKBmvGSc3pZ+7q+KwT 8OJ7MaoQ==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1q1CyQ-0085ER-0X; Mon, 22 May 2023 21:21:46 +0000 Date: Mon, 22 May 2023 14:21:46 -0700 From: Luis Chamberlain To: Harshit Mogalapalli Cc: linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org, error27@gmail.com, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] module: Fix use-after-free bug in read_file_mod_stats() Message-ID: References: <20230428055933.2699308-1-harshit.m.mogalapalli@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230428055933.2699308-1-harshit.m.mogalapalli@oracle.com> Sender: Luis Chamberlain X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,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, Apr 27, 2023 at 10:59:33PM -0700, Harshit Mogalapalli wrote: > Smatch warns: > kernel/module/stats.c:394 read_file_mod_stats() > warn: passing freed memory 'buf' > > We are passing 'buf' to simple_read_from_buffer() after freeing it. > > Fix this by changing the order of 'simple_read_from_buffer' and 'kfree'. > > Fixes: df3e764d8e5c ("module: add debug stats to help identify memory pressure") > Signed-off-by: Harshit Mogalapalli > --- Queued up, thanks! Luis