Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp2046652rwo; Thu, 3 Aug 2023 04:03:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlHZgIxViD0Q6izbOBXE0g/J2u8+xtq9HdNV5EWzzuLQgRoMeA4IMrIqyAM/2hDv1wzPPWld X-Received: by 2002:a05:6a21:3294:b0:13f:5eab:2deb with SMTP id yt20-20020a056a21329400b0013f5eab2debmr1851130pzb.17.1691060617757; Thu, 03 Aug 2023 04:03:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691060617; cv=none; d=google.com; s=arc-20160816; b=zh7pSjf0H2SgNkwMBrWH6D/5Ejkuw3NsGwmFa0E0OvQ+VvWfKF3Ldffwxq+buHz5xB V5d/iM/wZNvgTMLvEqrd4gqBGfis/NDQ1Eu6+Qw2qW3EJBxB4CHwDN02uG7OxQxHW6Ef LjnHVLpqY1v8tJkLQwcxhZcesRTe4ZKkfbq1xg1C+Q0f/y84djx9m4c5PT910NAS2L6F 1pg/Mg2YPMnDClsoaBtQ7NH0kf6STkfPBWtR7q6yYGPn2Q+YFTRhQvZK416JHlzCBTNf tTsIH/8gSzsQ97qzhp+mj2pT2fT6CNAiRL91WO6vTqGTSr7Vh+kRM8snpsigHmTrR2xV fqDA== 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:dkim-signature; bh=/RYOvA3GPH9yLj5LX7ItcBXbKrc7dBhaTvMPDzCiKhI=; fh=mk948m4q7bMBb1QznJrhM3GxJJOQLr5rlhsSKL1Kyi4=; b=AacJcEkGh3UOLzcnZ5Mo3Dl1C3uixN6LipRFgd/YrqjksaftAHStDpSyrcDCWlk2Db zM6/oX6A/nVw+ZoZrk6e1l9ZXjLECX/aCTwo22YB+P055igE/cZzWuNhBY/NQ6axYfDz obtImY39Ql9KIPvYWQOaqBulkyDlv5m9msJqEnsIYfzIhr442efI6vr7n647dgIWTccg OCMVJaqr6GDJz474zanTB65DG5TiVCR6Zt8VEXptE82zEQvbHRwDr3mfWvwNIVA8jJKE Z+z9ao6C/qEz//DfZZEVlQ3rwCHUp46/Ln4uK79w4K8JOQS3ke0a0jk58HzBhx5nLXZQ 5WUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@resnulli-us.20221208.gappssmtp.com header.s=20221208 header.b=QYpmTq0i; 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 w4-20020a63d744000000b005636b735110si12192179pgi.293.2023.08.03.04.03.25; Thu, 03 Aug 2023 04:03: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; dkim=pass header.i=@resnulli-us.20221208.gappssmtp.com header.s=20221208 header.b=QYpmTq0i; 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 S234883AbjHCI5j (ORCPT + 99 others); Thu, 3 Aug 2023 04:57:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234876AbjHCI5h (ORCPT ); Thu, 3 Aug 2023 04:57:37 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44818E53 for ; Thu, 3 Aug 2023 01:57:33 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-4fe27849e6aso1242689e87.1 for ; Thu, 03 Aug 2023 01:57:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20221208.gappssmtp.com; s=20221208; t=1691053051; x=1691657851; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=/RYOvA3GPH9yLj5LX7ItcBXbKrc7dBhaTvMPDzCiKhI=; b=QYpmTq0iHjjpPUROzsfV3ui565+LyzJjb6AZIaR2NMmJq0sK3A48bcGty+dpOSeQa7 QuHD1f9cYyP2WHWcPPqS2++NzTUR8+8GnpGP1+ZKQWGoGcN+Tk5wMMkGkjn7Huh3SFOg y2tUPyRRLAFSgKYkozMVDoA1YwvqO4/Rgo+vBSBqOsk0Gqro9NCEdM/YD5hJKzzA6sJO VdB0cClAJ42T0ojRpkkIZkCqtULtf31Swzq+nEl9AXh2HXWRV2lz9UeXvj/Ok5Yc6bkh Tphq9d9B1VPf6st5E/VRCbTvFD/BrlY0fzCb6N9umIxeU+4tGCT9uJ1SYySpM+E0OnnJ dOxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691053051; x=1691657851; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/RYOvA3GPH9yLj5LX7ItcBXbKrc7dBhaTvMPDzCiKhI=; b=fctYJ1PQTS/rb+hTcCF/aq8gJG3bqkFGQLPnt2TowF0XgXOLsjfypsn/VwD/NGqijV 4ictkI5dpj595Rh/eTjejWtkO+ZQRvt19hySTfUaj+Lulbk5n6Q+/PVQ0CwPerEG+W6d BSP2eXkWNDA+DXTFyO2Msdc8WjaUsjt5RyZ8C9dld4Drz0Ndgp/GcnYOx1PihLcQKoAT 6dnNiCY/xx/n6vU9B5J+Bg+HA17nHpPYycGRAVsNOhArPX1ZZFcAhAZ0yA/ECRCUz6Lt bp+/bQaHV4XbMXj4PiVDRm3tCh8onnSyxaAhjp7TkFc/2hF9GbgNnv/o0InALa7c82Gs jD/Q== X-Gm-Message-State: ABy/qLak7/qS23Jii6x00+wbi7ij4Yt+sOnRpF1H1AhSt3HzT+qTbiW3 hpBLWyTqmO8VeEPONxRwrOUeXQ== X-Received: by 2002:a2e:a0cf:0:b0:2b6:cb55:72bc with SMTP id f15-20020a2ea0cf000000b002b6cb5572bcmr7115600ljm.1.1691053051344; Thu, 03 Aug 2023 01:57:31 -0700 (PDT) Received: from localhost ([212.23.236.67]) by smtp.gmail.com with ESMTPSA id j4-20020a5d6184000000b003142c85fbcdsm21178152wru.11.2023.08.03.01.57.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Aug 2023 01:57:30 -0700 (PDT) Date: Thu, 3 Aug 2023 10:57:29 +0200 From: Jiri Pirko To: justinlai0215 Cc: kuba@kernel.org, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH] net/ethernet/realtek: Add Realtek automotive PCIe driver Message-ID: References: <20230803082513.6523-1-justinlai0215@realtek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230803082513.6523-1-justinlai0215@realtek.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Thu, Aug 03, 2023 at 10:25:13AM CEST, justinlai0215@realtek.com wrote: >This patch is to add the ethernet device driver for the PCIe interface of Realtek Automotive Ethernet Switch, >applicable to RTL9054, RTL9068, RTL9072, RTL9075, RTL9068, RTL9071. > >Signed-off-by: justinlai0215 [...] >+ >+static long rtase_swc_ioctl(struct file *p_file, unsigned int cmd, unsigned long arg) There are *MANY* thing wrong in this patch spotted just during 5 minutes skimming over the code, but this definitelly tops all of them. I didn't see so obvious kernel bypass attempt for a long time. Ugh, you can't be serious :/ I suggest to you take couple of rounds of consulting the patch with some skilled upstream developer internaly before you make another submission in order not not to waste time of reviewers. >+{ >+ long rc = 0; >+ struct rtase_swc_cmd_t sw_cmd; >+ >+ (void)p_file; >+ >+ if (rtase_swc_device.init_flag == 1u) { >+ rc = -ENXIO; >+ goto out; >+ } >+ >+ rc = (s64)(copy_from_user(&sw_cmd, (void *)arg, sizeof(struct rtase_swc_cmd_t))); >+ >+ if (rc != 0) { >+ SWC_DRIVER_INFO("rtase_swc copy_from_user failed."); >+ } else { >+ switch (cmd) { >+ case SWC_CMD_REG_GET: >+ rtase_swc_reg_get(&sw_cmd); >+ rc = (s64)(copy_to_user((void *)arg, &sw_cmd, >+ sizeof(struct rtase_swc_cmd_t))); >+ break; >+ >+ case SWC_CMD_REG_SET: >+ rtase_swc_reg_set(&sw_cmd); >+ rc = (s64)(copy_to_user((void *)arg, &sw_cmd, >+ sizeof(struct rtase_swc_cmd_t))); >+ break; >+ >+ default: >+ rc = -ENOTTY; >+ break; >+ } >+ } >+ >+out: >+ return rc; >+} [...]