From patchwork Mon Nov 29 15:14:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Gardner X-Patchwork-Id: 1561265 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=UbgjXpP7; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4J2pnQ3Ykrz9sS8 for ; Tue, 30 Nov 2021 02:15:21 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1mriMx-0002gA-UC; Mon, 29 Nov 2021 15:15:03 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1mriMw-0002fv-3X for kernel-team@lists.ubuntu.com; Mon, 29 Nov 2021 15:15:02 +0000 Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id E07A13F1A9 for ; Mon, 29 Nov 2021 15:15:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1638198901; bh=QpGGyYP+Pz7MyITzgdbtTGMJ4zrv76RttK+gpPwc0ig=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=UbgjXpP7haAh6ZKTUcm1JJCWxhuybbvX7lmMKSVJZ/0ehRgqGHSEwM7bFtWlrAQLH vSAcdIEU/uR5sXz6HXhFpwTJPtqOgC+ooNwiKYEM0gJ+ze1E7aez60RD89mzdDDjsL ElDpuXVtIsP2Ep/5DIk7flKdQI25+s/XEdYgs9c1BLTsxcol2p758hp7gsfKlgsMcp mVoqlHFnWpeODSe6NHtdn6I927vtz2B8VcE0GXHhh7slrHsgXZY/B+71MJnFJrVqt1 NiQoIONDVxhXmYKA10QxNsTnQkyGMeP//QrSNszsvvtuGqQOH3Dq1/iguCnbWAdBOp 342ox73Q7lxNg== Received: by mail-pl1-f198.google.com with SMTP id k9-20020a170902c40900b001421e921ccaso6479305plk.22 for ; Mon, 29 Nov 2021 07:15:01 -0800 (PST) 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=QpGGyYP+Pz7MyITzgdbtTGMJ4zrv76RttK+gpPwc0ig=; b=JtIVy/XItPRqV4vLJcN8swQ74e0oo03FFhfgIPJ37Z6OrsBOm4Te+jwErN1aF/MYBk WrIhYjvVsKpv8BDCFWjtYpUJYLiHqVme090iuy+16iUHuWN/nj5DRHGQfwUjs8LtUUO8 U+0j4T7MCpvcydsFQJtC8LFJO7uS0PAa/og9cfA76FDDTeCV5S+f0wAbiQ7c4jGo58zt xE1eHvR3L01fY/Y0AhTZYYKtI8AQYfxZVstC0+RqhHmXPhNe7jaa/7PuCKZcfavtrfzT /ZdwYgn8zmeOmClw/2ZfVQV+t9W3TfSgkRdIpQFmamdY7N32WY4dMjeIPrmH0HtDX3Lr vwdw== X-Gm-Message-State: AOAM531WMW1eBTZTgeVYBOdpWxxqxpccWuT74xk3008/OELErXzvTPWc Jjo9zUyWhk01RDp+w08mWUvLsDd0fdiw7bkyGfMqEhbt2JwI8OOL1FU2PMbZr/swsjbfFCYZ+LB Uls70WB3Ql6n2rvkarz/Hksr3FUePRVl0gCIujdb74w== X-Received: by 2002:a05:6a00:1312:b0:4a4:e341:213a with SMTP id j18-20020a056a00131200b004a4e341213amr39530173pfu.57.1638198900303; Mon, 29 Nov 2021 07:15:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJyaFBqjtfVbimC2riaBLmt+OO/p5No0/p0M9GT7mmcCk9XtxR53KDm7cLYuU9Zo/x0lrTCrdg== X-Received: by 2002:a05:6a00:1312:b0:4a4:e341:213a with SMTP id j18-20020a056a00131200b004a4e341213amr39530149pfu.57.1638198900044; Mon, 29 Nov 2021 07:15:00 -0800 (PST) Received: from localhost.localdomain ([69.163.84.166]) by smtp.gmail.com with ESMTPSA id r21sm16608069pfh.128.2021.11.29.07.14.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Nov 2021 07:14:59 -0800 (PST) From: Tim Gardner To: kernel-team@lists.ubuntu.com Subject: [PATCH][focal/linux, bionic/linux, hirsute/linux, hirsute/linux-azure] Revert "CIFS: Fix a potencially linear read overflow" Date: Mon, 29 Nov 2021 08:14:58 -0700 Message-Id: <20211129151458.22189-1-tim.gardner@canonical.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1952094 This reverts commit 3d5631a27ec4767ac80dbf553f9ae501b18e07e3. This stable patch causes a regression. There are no subsequent upstream fixes. Signed-off-by: Tim Gardner Acked-by: Kamal Mostafa --- I'll ask the upstream reviewers about reverting or fixing this patch. Its been included in many stable releases: linux-4.4.y.txt:0955df2d9bf4857e3e2287e3028903e6cec06c30 CIFS: Fix a potencially linear read overflow linux-4.9.y.txt:8878af780747f498551b7d360cae61b415798f18 CIFS: Fix a potencially linear read overflow linux-4.14.y.txt:20967547ffc6039f17c63a1c24eb779ee166b245 CIFS: Fix a potencially linear read overflow linux-4.19.y.txt:bea655491daf39f1934a71bf576bf3499092d3a4 CIFS: Fix a potencially linear read overflow linux-5.4.y.txt:b444064a0e0ef64491b8739a9ae05a952b5f8974 CIFS: Fix a potencially linear read overflow linux-5.10.y.txt:6c4857203ffa36918136756a889b12c5864bc4ad CIFS: Fix a potencially linear read overflow linux-5.13.y.txt:9bffe470e9b537075345406512df01ca2188b725 CIFS: Fix a potencially linear read overflow linux-5.14.y.txt:c41dd61c86482ab34f6f039b13296308018fd99b CIFS: Fix a potencially linear read overflow rtg --- fs/cifs/cifs_unicode.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c index 171ad8b42107e..9bd03a2310328 100644 --- a/fs/cifs/cifs_unicode.c +++ b/fs/cifs/cifs_unicode.c @@ -358,9 +358,14 @@ cifs_strndup_from_utf16(const char *src, const int maxlen, if (!dst) return NULL; cifs_from_utf16(dst, (__le16 *) src, len, maxlen, codepage, - NO_MAP_UNI_RSVD); + NO_MAP_UNI_RSVD); } else { - dst = kstrndup(src, maxlen, GFP_KERNEL); + len = strnlen(src, maxlen); + len++; + dst = kmalloc(len, GFP_KERNEL); + if (!dst) + return NULL; + strlcpy(dst, src, len); } return dst;