Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2252868iof; Wed, 8 Jun 2022 00:33:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwh4GSoro7edH4UqS5OEbx32ATBR/MPygsE3GRrP44e4r2iNUkTi9dGKXysX30cJBMz3MRd X-Received: by 2002:a17:90a:86c8:b0:1e6:7147:8b4d with SMTP id y8-20020a17090a86c800b001e671478b4dmr36145130pjv.45.1654673619844; Wed, 08 Jun 2022 00:33:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654673619; cv=none; d=google.com; s=arc-20160816; b=CGdRd2eHP19iDLcBr6quKNcqCjOt08R/3KsMAmQQVQRCgiSlxVk1113Ld+QWkpzcz5 YkcWAUYu6aA6pmU5OlzP4CB0HnMghNkvOwXNnE675PWFNPvV7TgxlfpyYpbl+ukRWY68 3FrgE8nRHJGqOSpqjSJd8H7lhqwYZDJ45GaQGhvNEVt31uvGIXYXIuDOea2ObigBOcCk Pb5rFbERMXrDHxycBjD4ZrIVpEoFle2r8vE47Yw2YWJS8B2twWpRv5cYyuJTuHAuuUdK ReYHOINKOrrJayehvCE50+4HPqmvLd9bsIreTzXxE0vxc+DwMXNuue84RiR8bZp/yNB2 ZG4A== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=COofM4p4XVL9HB7oV/hO48snBSXqaKhyKNYxseRZ7lY=; b=Qi37M0M11MbhFO6/e1TOcRKIbK0Zu62rUb0JTaFyrVliOar/h9j8KyVaFLQFL8a54A NXUkKKlIxyo4wrezm+LXPoqcxuJSprEgsRaXT41Z5FVn8yEo23V/ByOqsLZ/D6npt2WU Ibu52n5AVzSGgfsy0eMs6H3s3XxX58PCFWd26mfiG4a8rw7u0WN4n+CxL6Y+QbyD/Vcb Y04SZ2RHjHG/v2K11vbIYwWaX93W9CzZmk0CTlNCqkt11Q5BbLYMrJXdyewVqIet1E0H kzt7BCPHbJoh2IeZRYkat0SalxQTiYYPVAeNN35Y4Yx7rmMPb59iY64511PqJN8Cccbm Fa/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="G/nza0Fj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id r134-20020a632b8c000000b003fe1c0a9903si3439789pgr.348.2022.06.08.00.33.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 00:33:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="G/nza0Fj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E539621CBC9; Wed, 8 Jun 2022 00:06:19 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354318AbiFHCI5 (ORCPT + 99 others); Tue, 7 Jun 2022 22:08:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382765AbiFHAyp (ORCPT ); Tue, 7 Jun 2022 20:54:45 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9161627CCDA for ; Tue, 7 Jun 2022 12:26:02 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id h23so29833324lfe.4 for ; Tue, 07 Jun 2022 12:26:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=COofM4p4XVL9HB7oV/hO48snBSXqaKhyKNYxseRZ7lY=; b=G/nza0Fj5r13MS+16/+zxQ6N7QIcMnCbPyyB2FoNYT48p6k8Zbpu1sSpGFr0CJTfbH VswbNromqseElL/xO/gEFqDm3627364XoAnLx5K2lu0/J9b/kf9t5ODKTW2oGdKSLLju S6vrMJkkpzqHDTDRyl/QzUoRHtecUkDCtAbsXVFnuLKvCk5lEjdPWVKXQ9FTSuw3bIcJ HpbdAAqn0XuwrQQEYTfeZO/Wc7HYpB4FVMMPAj4WVnKLPPF1al9SFXh7fXNKryst34EL lmKC9VhAf6fnjCHU8jrap9sczA4sULSggG4fX0bL5FtJ5kkKgqS3cvAhbREmA2pwbP2a 6lug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=COofM4p4XVL9HB7oV/hO48snBSXqaKhyKNYxseRZ7lY=; b=Ss7IAlBssrdm+Vo9KIfglgEtjy8F2++2IV/sIXpElPPVAdZ7KH431fBcI+TIA2ZJwI O24KwgibvFgHFcCvgoOio7Evi0MaKxnSHVxobKPuEPydPexOcrPAFlz6azEulHAzrxQp U5aElRH8ANjXSQxr1PQI7cf3IIf29LZyzmFXtlBwh0ol7mPgL6S8CWv0XLVbObQsWz3Q ksSSxxFI7AUCRPH88J6BqKkrExZxEHAYLy8DTONyIOXexemyS69rPOdlHZjM1c4/G2gu dJEPg5nNM0SOK6XtjbQYOjMySqJ245ISNhZqWrsOX9vA+o5N6iazhVqTJSkK+o1udB69 YHYQ== X-Gm-Message-State: AOAM531nBYt8oUj0Dp8la1cUDURjbOPjwk0GyGIj5iE7Hdf/Lbiq0KjP NOK7cphWtXhkjBKrVbgMdtA= X-Received: by 2002:a05:6512:53a:b0:479:1725:51f2 with SMTP id o26-20020a056512053a00b00479172551f2mr16188235lfc.688.1654629960872; Tue, 07 Jun 2022 12:26:00 -0700 (PDT) Received: from localhost.localdomain ([94.103.229.27]) by smtp.gmail.com with ESMTPSA id a27-20020a056512201b00b0047900ad3f90sm3401917lfb.29.2022.06.07.12.25.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 12:26:00 -0700 (PDT) From: Pavel Skripkin To: gregkh@linuxfoundation.org, Larry.Finger@lwfinger.net, phil@philpotter.co.uk, straube.linux@gmail.com, dan.carpenter@oracle.com Cc: linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Pavel Skripkin Subject: [PATCH v4 0/4] staging: r8188eu: add error handling of usb read errors Date: Tue, 7 Jun 2022 22:25:53 +0300 Message-Id: X-Mailer: git-send-email 2.36.1 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 Hi, it's reincarnation of my old series for adding sane error handling in r8818eu. *Problem* Old code was returning just stack variable in case of read error. It's not the best approach, since passing around stack data might cause device misconfiguration or even kernel data leakage To solve this I've changed rtw_read{8,16,32} prototypes to return an error via return value and data via passed pointer. Some work should be done to propogate an error down to calltrace, but it's good way to at least start doing sane I/O error handling Tested locally on qemu with TP-Link TL-WN722N v2/v3 [Realtek RTL8188EUS] device. More testing is welcomed, of course :) _NOTE_ Series is based on top of staging-testing branch. Changes since v3: fix build error in 1/4 caused by unused local variable Changes since v2: get rid of `(void)res` and return an error from function instead of hiding it Changes since v1: addresses issues found by Dan and self review. Mostly related to returning _FAIL instead of -errno, since callers expect _FAIL/_SUCCESS v1: https://lore.kernel.org/linux-staging/cover.1652911343.git.paskripkin@gmail.com/ v2: https://lore.kernel.org/linux-staging/cover.1652994483.git.paskripkin@gmail.com/ v3: https://lore.kernel.org/linux-staging/cover.1654543286.git.paskripkin@gmail.com/ Pavel Skripkin (4): staging: r8188eu: add error handling of rtw_read8 staging: r8188eu: add error handling of rtw_read16 staging: r8188eu: add error handling of rtw_read32 MAINTAINERS: add myself as r8188eu reviewer MAINTAINERS | 1 + drivers/staging/r8188eu/core/rtw_cmd.c | 15 +- drivers/staging/r8188eu/core/rtw_efuse.c | 33 ++- drivers/staging/r8188eu/core/rtw_fw.c | 72 +++-- drivers/staging/r8188eu/core/rtw_led.c | 16 +- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 62 ++++- drivers/staging/r8188eu/core/rtw_pwrctrl.c | 9 +- drivers/staging/r8188eu/core/rtw_wlan_util.c | 20 +- .../r8188eu/hal/Hal8188ERateAdaptive.c | 21 +- drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 21 +- drivers/staging/r8188eu/hal/HalPwrSeqCmd.c | 9 +- drivers/staging/r8188eu/hal/hal_com.c | 27 +- drivers/staging/r8188eu/hal/rtl8188e_cmd.c | 37 ++- drivers/staging/r8188eu/hal/rtl8188e_dm.c | 6 +- .../staging/r8188eu/hal/rtl8188e_hal_init.c | 136 +++++++--- drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 30 ++- drivers/staging/r8188eu/hal/usb_halinit.c | 251 +++++++++++++++--- drivers/staging/r8188eu/hal/usb_ops_linux.c | 33 ++- drivers/staging/r8188eu/include/rtw_io.h | 6 +- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 47 +++- drivers/staging/r8188eu/os_dep/os_intfs.c | 19 +- 21 files changed, 693 insertions(+), 178 deletions(-) -- 2.36.1