Received: by 2002:ac8:6216:0:b0:41c:c224:f26f with SMTP id ks22csp88667qtb; Thu, 2 Nov 2023 12:20:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF2/jWoIfZyajVBU9FIsPtUQdgASiwQ7IGVGSU0wYYjMDuqAyqpBbqiymqD7K6Ovu/evG7l X-Received: by 2002:a17:90a:db92:b0:27f:df1a:caab with SMTP id h18-20020a17090adb9200b0027fdf1acaabmr18278664pjv.21.1698952832577; Thu, 02 Nov 2023 12:20:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698952832; cv=none; d=google.com; s=arc-20160816; b=YA713ZgWNPvRk4sHGLZQobN5G4jwt4BB/DmELFRPf5EGHL4AJ/CyuJWLGKTtbimFG9 +DQD4O94uL7ypu/NKE9Poow9TdDm0pORhBeUKaaXDBeJDZ1Bu5fCZU98qXvYZieu2QJL kL8B4ZT0nnfQYtksvKIbEnEasqEmJ+u1gXiJo79ZAqOOFqarGZaAlBRNDIw30CZZfZwS c3lVEpNeePneAc6OnVA9S1PQSnGSsCNW2wDVn6t8w1rZorAaeOqfxy9L/bHjZt4ER72H ExFQhcIkozUFXOWQPX8kMXwBAweEWJIjpJ2e3Kldhf4ajCZACd/y9w1S4CmNEhz13JTe L/kw== 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=VH/N2+u/BX61pZEFnFU4abdjTRFxE7atZBHYbezDKHQ=; fh=5gehztVVtm/u5sGB1tOX4nsrNiYQNBSdXfjnCMVCu0Q=; b=mrYeQuwGmLLzk72SgmjNW652aST1B22Z95Lk+UuVEe351EvTkBlxPR99thSx3Tprf3 1ABUMFdw1IJLHFvqq0TzVEysJhm3wLriQyMjjQHg7KVd/UlDjLUVs7HIrtgPclCFGZqt I/+XxAZKYa4jBfHr57Ld7MyZMDach4p+CF6Cb3LpwKTS6SEmsKisJcCVvU5oKVJGvNi0 oRDzm5NQmkHn2RqLrfa0L6Yw6hAj5E0F0mjj7fEEgILWYRLL9sitff/yXVUJBRAuFsG3 reKQr5TnpZE6ROZe5LeDZD1AlGvveaKfstXWo6vYALjTDdgeWa2TFFkq+kiisfuDUA2l 27TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Vhva4KTk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id a3-20020a63e403000000b005b8615b9fe6si139723pgi.287.2023.11.02.12.20.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 12:20:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Vhva4KTk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id B74A68022719; Thu, 2 Nov 2023 12:20:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345284AbjKBTUT (ORCPT + 99 others); Thu, 2 Nov 2023 15:20:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233257AbjKBTUS (ORCPT ); Thu, 2 Nov 2023 15:20:18 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04BC3184 for ; Thu, 2 Nov 2023 12:19:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698952769; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=VH/N2+u/BX61pZEFnFU4abdjTRFxE7atZBHYbezDKHQ=; b=Vhva4KTkpA0DZA+QYn4Huiv8TbDsZRogH7ulMW9S5BCIFkDFUAo9eBON/hrSj2HvikXXU2 Gs+mooYwendhU0CvCO+jhe9l75f9Dk0p1ABcZFpnJvMfbSchd5dMSCbKa1rOi9aNp1dxlS gWHZhsn1unrtBssJOMtstUjy4RYGZVg= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-64-zdbuHNtHMOSt-W6XXiHcgg-1; Thu, 02 Nov 2023 15:19:27 -0400 X-MC-Unique: zdbuHNtHMOSt-W6XXiHcgg-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-32dfbc50f1dso172025f8f.1 for ; Thu, 02 Nov 2023 12:19:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698952766; x=1699557566; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VH/N2+u/BX61pZEFnFU4abdjTRFxE7atZBHYbezDKHQ=; b=TB7uKQehhvTtNM3RKe1hhUorkZsENsjEVwn62QolLSMwpB8mcKMadBm4BLunp8Ad8v Sl96QcV6k36HVTFLuvZTD2KDaxKkYAgOCnVXg/mXIfbpJzUqGdKGDqOt9Ddw0ZC2w0Xt 142dwOUVdeJ1c4d2TdLNsXXB6Rj1BW7ekikCpuMsWNEMDpoDNuSvZCD4cyoux5WnwcX1 WCj5R6ehpLh72kkfGrRrET9DMHST32ugBR88o8Dk1LtPMQwLKT2bK4i7OhViz4IWZPig Mm35bKvb6pBV1xWANOW5Et9AVCm0IqbCPE3HBYo0n1o8l5DdtzlCraW4GAvpz1P8mT3m ZkXQ== X-Gm-Message-State: AOJu0YwRkYjeerFKLoC4F6nDrEQe1PliXUwc8Z+BRc03A82zmmFKw9a4 hcukHmSYf9XgMnZfjcb/CVcB+84v6XL21vM70kcfRzAdy0VmOA45yA9tTqJ2A44pcf5m/Qi6ZX3 4VRZ+4XBtz4b6TOzl/QC3wH5B X-Received: by 2002:a05:600c:510a:b0:405:1ba2:4fcf with SMTP id o10-20020a05600c510a00b004051ba24fcfmr15748999wms.4.1698952766729; Thu, 02 Nov 2023 12:19:26 -0700 (PDT) X-Received: by 2002:a05:600c:510a:b0:405:1ba2:4fcf with SMTP id o10-20020a05600c510a00b004051ba24fcfmr15748984wms.4.1698952766361; Thu, 02 Nov 2023 12:19:26 -0700 (PDT) Received: from pstanner-thinkpadt14sgen1.remote.csb ([2001:9e8:32c5:d600:227b:d2ff:fe26:2a7a]) by smtp.gmail.com with ESMTPSA id v3-20020a5d4a43000000b003232380ffd7sm86618wrs.102.2023.11.02.12.19.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 12:19:25 -0700 (PDT) From: Philipp Stanner To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Stanislav Fomichev , Greg Kroah-Hartman , Benjamin Tissoires , Al Viro Cc: linux-ppp@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Philipp Stanner , Dave Airlie Subject: [PATCH] drivers/net/ppp: copy userspace array safely Date: Thu, 2 Nov 2023 20:19:15 +0100 Message-ID: <20231102191914.52957-2-pstanner@redhat.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 02 Nov 2023 12:20:25 -0700 (PDT) In ppp_generic.c memdup_user() is utilized to copy a userspace array. This is done without an overflow check. Use the new wrapper memdup_array_user() to copy the array more safely. Suggested-by: Dave Airlie Signed-off-by: Philipp Stanner --- drivers/net/ppp/ppp_generic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index a9beacd552cf..0193af2d31c9 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c @@ -570,8 +570,8 @@ static struct bpf_prog *get_filter(struct sock_fprog *uprog) /* uprog->len is unsigned short, so no overflow here */ fprog.len = uprog->len; - fprog.filter = memdup_user(uprog->filter, - uprog->len * sizeof(struct sock_filter)); + fprog.filter = memdup_array_user(uprog->filter, + uprog->len, sizeof(struct sock_filter)); if (IS_ERR(fprog.filter)) return ERR_CAST(fprog.filter); -- 2.41.0