From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B141C432C3 for ; Thu, 21 Nov 2019 21:25:37 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2B1032068D for ; Thu, 21 Nov 2019 21:25:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="D4NaKQFW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2B1032068D Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=driverdev-devel-bounces@linuxdriverproject.org Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 14FEB888DE; Thu, 21 Nov 2019 21:25:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cLmP9qljdV-l; Thu, 21 Nov 2019 21:25:35 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 0088B884A6; Thu, 21 Nov 2019 21:25:35 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id E52AB1BF343 for ; Thu, 21 Nov 2019 21:25:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id DCF5B8810D for ; Thu, 21 Nov 2019 21:25:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WT6K8MEf6i4E for ; Thu, 21 Nov 2019 21:25:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by whitealder.osuosl.org (Postfix) with ESMTPS id 62EB5880E9 for ; Thu, 21 Nov 2019 21:25:32 +0000 (UTC) Received: by mail-pl1-f195.google.com with SMTP id o9so2166721plk.6 for ; Thu, 21 Nov 2019 13:25:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kBYoGW6pslzpDWF+e4NaY7GXTypsHdcIulpf1km4Z08=; b=D4NaKQFWFIx1FJkfG2zVoB6NEmd758nicUXM4RLquUXKlfCEh5OyD9dHvLpH0Huwh7 0chf6G9m1hDwDeXAn9vS2s4jyUw7c648YOaaq+GVdRrIVZ0nZyQQflC13lKt58rILz7I /R4NNBLvouI6fSS0DVflVUiYgdBbmEk517cRYiq+acNX9e3nLq8Xq3+5XP4zLh8/Kada hj1CiaqneKtdlEbKwyXRdCjfiFlSEybat4kvhQKmQTf62KzqRLTsv7BtZzBPktfY8hWg BpinsX+F/7sUe97sIGHtwRadnDB65GJPmiSa+ZnYswTTsk1GuYXlVfgvvQMc1LR2pX8y FxjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kBYoGW6pslzpDWF+e4NaY7GXTypsHdcIulpf1km4Z08=; b=KuK6TNV2wBilnzEEVRWTjvYeloQ4aApP4+U27X/mTwKS884F5gaLK1nJiNgDlOQ6Jg Kua7EBpreXQQZOzpBoxQJqrvtP6LeiCkEQdAb1B7ugs6rR/NVP4bHTuVHWaXx5sA4Sn1 AzTBcbWTlY33rGtlpN2zHniSHobsVtD8m87Xe/C1Br3gCsOkr+IjxZqF7FWJvY97MLwr CIvQfNpxhgBcWJxxEHydTOUtd9dTzOpoqgpQ1LNuRZfPxz5rC9SLPgzLAku/fHcnTXS9 izFUjHWbDzDSymSkZu8gYAyiXd2AkR4QrXhkIu9KOoIGvB3hPmBEhD+wFwlfOLv8vVN9 94fw== X-Gm-Message-State: APjAAAU/v/kE2SVrYDwAXGiG71DM3T2AcHYKRDaZasvVB9BccHFOnhvx RYYWo5AWRPf006R2MmRdA0ShLCf3PIw4YGu4grOZ7+tXXQs= X-Google-Smtp-Source: APXvYqy7/OGRq/YShQ3QVFQiadGctIcoLXl6MaICG/3+wS54kuULTu2WiucVQ75Pfzbe/yte8Z+TfrHvR7m4lBc8odY= X-Received: by 2002:a17:90a:80cc:: with SMTP id k12mr14633384pjw.58.1574371531606; Thu, 21 Nov 2019 13:25:31 -0800 (PST) MIME-Version: 1.0 References: <20191120185047.GE5604@kadam> In-Reply-To: <20191120185047.GE5604@kadam> From: Marcelo Diop-Gonzalez Date: Thu, 21 Nov 2019 16:25:20 -0500 Message-ID: Subject: Re: [PATCH 3/3] staging: vchiq: Have vchiq_dump_* functions return an error code To: Dan Carpenter X-BeenThere: driverdev-devel@linuxdriverproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devel@driverdev.osuosl.org, Greg KH , linux-rpi-kernel@lists.infradead.org, Stefan Wahren , eric@anholt.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" On Wed, Nov 20, 2019 at 1:51 PM Dan Carpenter wrote: > > Thanks for the patch. Looks good. > > Reviewed-by: Dan Carpenter Appreciate the review! -Marcelo > > On Wed, Nov 20, 2019 at 10:36:48AM -0500, Marcelo Diop-Gonzalez wrote: > > copy_bytes = min_t(int, len, context->space - context->actual); > > if (copy_bytes == 0) > > - return; > > + return 0; > > if (copy_to_user(context->buf + context->actual, str, > > copy_bytes)) > > - context->actual = -EFAULT; > ^^^^^^^^^^^^^^^^^^^^^^^^^ > > > + return -EFAULT; > > context->actual += copy_bytes; > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > In the original code we saved the error code to context->actual, then > we added some bytes > > > len -= copy_bytes; > > > > @@ -2109,8 +2108,9 @@ vchiq_dump(void *dump_context, const char *str, int len) > > > > if (copy_to_user(context->buf + context->actual - 1, > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > and then we tried to use the result to corrupt the user space program. > So this patch is a nice bug fix. > > > &cr, 1)) > > - context->actual = -EFAULT; > > + return -EFAULT; > > } > > + return 0; > > } > > regards, > dan carpenter _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel