From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 490C2AD23 for ; Thu, 27 Oct 2022 17:05:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4796C433D7; Thu, 27 Oct 2022 17:05:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666890338; bh=pEjoXFLzwBOzGkb5od/GN6OwHCtgQZw+Phbg6TJLxaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DAojdQVMhrMkQQ8vtNv4rPnuaETiSuksNwv9UWsglqU15VgrXnpt7AM+2Z0VPR+n1 JSha+PJoCYvGCSEgfwFV7BW1/Zi5N8AJekXGDyUkTUpT7q5yK28FE1fnNQjPrFoHkN t3InftbEgjo/1t/sxbChSShMhptdC9aJkzD8MAK8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Xiaobo Liu , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 33/79] net/atm: fix proc_mpc_write incorrect return value Date: Thu, 27 Oct 2022 18:55:43 +0200 Message-Id: <20221027165055.506105455@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221027165054.270676357@linuxfoundation.org> References: <20221027165054.270676357@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Xiaobo Liu [ Upstream commit d8bde3bf7f82dac5fc68a62c2816793a12cafa2a ] Then the input contains '\0' or '\n', proc_mpc_write has read them, so the return value needs +1. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Xiaobo Liu Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/atm/mpoa_proc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/atm/mpoa_proc.c b/net/atm/mpoa_proc.c index 829db9eba0cb..aaf64b953915 100644 --- a/net/atm/mpoa_proc.c +++ b/net/atm/mpoa_proc.c @@ -219,11 +219,12 @@ static ssize_t proc_mpc_write(struct file *file, const char __user *buff, if (!page) return -ENOMEM; - for (p = page, len = 0; len < nbytes; p++, len++) { + for (p = page, len = 0; len < nbytes; p++) { if (get_user(*p, buff++)) { free_page((unsigned long)page); return -EFAULT; } + len += 1; if (*p == '\0' || *p == '\n') break; } -- 2.35.1