From nobody Thu Apr 2 13:35:40 2026 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 D0E1BC07E9D for ; Sat, 24 Sep 2022 14:18:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229621AbiIXOSI (ORCPT ); Sat, 24 Sep 2022 10:18:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbiIXOSF (ORCPT ); Sat, 24 Sep 2022 10:18:05 -0400 Received: from cmccmta3.chinamobile.com (cmccmta3.chinamobile.com [221.176.66.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8559725C4E for ; Sat, 24 Sep 2022 07:17:59 -0700 (PDT) X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from spf.mail.chinamobile.com (unknown[172.16.121.3]) by rmmx-syy-dmz-app09-12009 (RichMail) with SMTP id 2ee9632f1193b52-e119a; Sat, 24 Sep 2022 22:17:57 +0800 (CST) X-RM-TRANSID: 2ee9632f1193b52-e119a X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost.localdomain (unknown[223.64.113.136]) by rmsmtp-syy-appsvr02-12002 (RichMail) with SMTP id 2ee2632f117a251-45be7; Sat, 24 Sep 2022 22:17:56 +0800 (CST) X-RM-TRANSID: 2ee2632f117a251-45be7 From: liujing To: vgoyal@redhat.com Cc: stefanha@redhat.com, miklos@szeredi.hu, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, liujing Subject: [PATCH] virtio_fs.c: add check kmalloc return Date: Sat, 24 Sep 2022 10:17:28 -0400 Message-Id: <20220924141728.3343-1-liujing@cmss.chinamobile.com> X-Mailer: git-send-email 2.18.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: liujing --- fs/fuse/virtio_fs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c index 4d8d4f16c727..07334c9c2883 100644 --- a/fs/fuse/virtio_fs.c +++ b/fs/fuse/virtio_fs.c @@ -989,6 +989,10 @@ __releases(fiq->lock) =20 /* Allocate a buffer for the request */ forget =3D kmalloc(sizeof(*forget), GFP_NOFS | __GFP_NOFAIL); + + if (forget =3D=3D NULL) + return -ENOMEM; + req =3D &forget->req; =20 req->ih =3D (struct fuse_in_header){ --=20 2.18.2