Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3546651pxb; Mon, 4 Apr 2022 20:46:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxo0bEf6UBHlRtmTfuIonx1DHYIuasPYjDg/i5Wlk95H0zboK00qdxRHASzAayxUJMXNNcf X-Received: by 2002:a62:18cf:0:b0:4fa:6d07:8b9b with SMTP id 198-20020a6218cf000000b004fa6d078b9bmr1482549pfy.61.1649130379166; Mon, 04 Apr 2022 20:46:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649130379; cv=none; d=google.com; s=arc-20160816; b=lLFhQwpx+MnccEp0vr+FiBNb7sg26uPR1VAhq382roHjp7nsXCb9yV4ZuLE63GqLHm vyaQsCinybYdMf262+iJbGzfnBso0zMnwSSNMAlcKNg4FVver0xMduCxHQPoHifHWG6I 5veTZBbIFXxBgyXdRklesbXDf1I8BQkmYETpnCHdZNX33VCqxdjcI6epLO8/yvLFQ6ID OgGeJFoQ0U2CQKOujd84jRrqlgxHjvWVLArjMF7VggZ2MwzA2594C98Zpf41glC1gl9O u16+Ii47YNcgLLfYFhpC47ZeBNjBU/btRIQG6P7/DRErYJd1ydUbShqLiNcryqrli8cY 0JCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:subject:cc:to:from:message-id :dkim-signature; bh=/3yGeZ7g3ndrgq7ezahWJRS7qUXCaNhhVgCTWOxAzag=; b=XUi8jtSTvPNaFOMF0srD773kh+LU5ofXttC27f9HzNXR2fS+4L1ZeMxCHoLmKjrKUY n/vfjbjj7uApcFaZLyq+uGqnh+tbjPm1si9yMnwoWmjX3x3dqPcpXX1soIAtuUv29M76 MquVOEnGgqkPNou21PYEZDnaWhZ5qVSeHpWuHFEn9qpV8iQLS+yIhdfj89o57xkqphkb QCJQlnCG0MJQXYNJ89yKy+eq9QZEJbG/Jtz+C01eUmQOCPv1zSsg2qSTnWP4EwLsiENk d6M+/hiGjWX2vkutd/qIHhb3z/o/klg+BeB10lCrf3ycPdBrETj2DZR6X9wsXRjhHKOU M6uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=hiVX729o; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id m65-20020a632644000000b003816043ef69si11870410pgm.350.2022.04.04.20.46.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 20:46:19 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-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=@foxmail.com header.s=s201512 header.b=hiVX729o; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7E654289FB7; Mon, 4 Apr 2022 19:46:55 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229893AbiDECsr (ORCPT + 99 others); Mon, 4 Apr 2022 22:48:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230186AbiDECsj (ORCPT ); Mon, 4 Apr 2022 22:48:39 -0400 Received: from out203-205-221-192.mail.qq.com (out203-205-221-192.mail.qq.com [203.205.221.192]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9615239971C for ; Mon, 4 Apr 2022 19:29:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1649125766; bh=/3yGeZ7g3ndrgq7ezahWJRS7qUXCaNhhVgCTWOxAzag=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hiVX729ojZibzmsVbnRRNjdi7b2WXsBa62yHRFBLvIhxBXuPK2HdBXQQgzH0UL8Na SyWutGcrOT6sb7xMQf0+eRRZ4m/UvcuK9iJ7iHax3QUhsY5qEUOCinmbkPk+brMfl0 QdoWEi3pK1qmIlV3So3F+zWUOgFnaw/exPqQmNl4= Received: from localhost.localdomain ([218.197.153.188]) by newxmesmtplogicsvrszb6.qq.com (NewEsmtp) with SMTP id 757B7698; Tue, 05 Apr 2022 10:29:23 +0800 X-QQ-mid: xmsmtpt1649125763tz7r97vbw Message-ID: X-QQ-XMAILINFO: MDPfhejMR4aIUaXnh8SbAwTwpPAr4zJrY0xemmO5ZgY90J4sb4/U2jqT05KAWV G6glXny0sgROGUGBbVUdn27Tw38QXvlDOp8Enm68/axsxQZr/FME463zEIa5Iwg9G5suiHWWQMcP xmmfOhvTfIsgQEMcvk9sQiHAXFTJUroanhaEvI952KT/88nwrNRlqA00pLLpDm1KNQcI6nCk9RF5 Yxq94CJ+ei5ptPAGV+7IbZupHsmzu3NB8o9w0tGfP8wxTeBs/zXpcanGCxnlXbc1BVvSqvuVFPJY a0ytrkhcyijw/c6X5KlKpEpmsTemHPWDTqrjGsdYSHk2ZGX6F4JXGkmVKUDoKXKQadVLb4KuuxzB N6ZlGjYX21OwOEGVyyz2DmHlqbSXfRnDYJVVWSe7lkWDYINxh6+OgnYsmZlx3XiLrYgyEkmk1yc2 pJzmQ8YhY9lUu6W036SNV6xzQC8mdCdKyi+CRNMTMZSGjqjWphewxu/vIHGuV4WmgLAf60Nye3tI 1jhbV87Lk1WNRcbnnuI1wE2X1DbDHeY5ZjnkOOw96/LvosN2nwzsnxfQrvQRtxxunvJGZG4hBrob FZLpnvdgMlBAf0HiFNTj9Ub8EEW+66W233i5kncz5Hkth0MtYlW/hGAo9tvg9rDhfWrFMlBfxMGE fTsIStPUYSARxoRWWjvIz8UrdaEG2J7SA61uuGNPkqzIwm6Oo1ZU5gjqrudsQ54MKKYXboaE76+g Tv7ozgj6ytxDEH8XrpFD9ThvjXmL8lnzy/pGIlpc+zy+y47svDM3WACdZ9k/2f+FOsdqUFeR85rm IJa3f6+mp8RdmS0mHa0RdrxrxJq+QsfRjHFLFanFjjwKx30S+f3Rd1PVPs5WcG6vwK+ksxCMm8rQ VBJsFo23ODnJeVgV5n3OQsQEKZKitEilprmeR500tASyf/eYzxVjHpSAkLuUySBjVbIpzCzg9lBE NvwiYLy2tCGddBTFHygO08AyqRfxUYU+1jXRY4BbnBbiWg8J3ERw== From: xkernel.wang@foxmail.com To: gregkh@linuxfoundation.org Cc: Larry.Finger@lwfinger.net, florian.c.schilhabel@googlemail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Xiaoke Wang Subject: [PATCH v2 3/3] staging: rtl8712: add two validation check in r8712_init_drv_sw() Date: Tue, 5 Apr 2022 10:28:54 +0800 X-OQ-MSGID: <20220405022854.10991-1-xkernel.wang@foxmail.com> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Xiaoke Wang _r8712_init_xmit_priv() or _r8712_init_recv_priv() returns -ENOMEM when some allocations inside it failed. So it is better to check the return status of them. Signed-off-by: Xiaoke Wang --- ChangeLog: v1->v2 adjust the sequence of patches in this series and add error handlers in the first patch. drivers/staging/rtl8712/os_intfs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c index 1f7ccec..0dbf8c2 100644 --- a/drivers/staging/rtl8712/os_intfs.c +++ b/drivers/staging/rtl8712/os_intfs.c @@ -308,8 +308,12 @@ int r8712_init_drv_sw(struct _adapter *padapter) ret = r8712_init_mlme_priv(padapter); if (ret) goto free_evt_priv; - _r8712_init_xmit_priv(&padapter->xmitpriv, padapter); - _r8712_init_recv_priv(&padapter->recvpriv, padapter); + ret = _r8712_init_xmit_priv(&padapter->xmitpriv, padapter); + if (ret) + goto free_mlme_priv; + ret = _r8712_init_recv_priv(&padapter->recvpriv, padapter); + if (ret) + goto free_xmit_priv; memset((unsigned char *)&padapter->securitypriv, 0, sizeof(struct security_priv)); timer_setup(&padapter->securitypriv.tkip_timer, --