From patchwork Mon Sep 21 16:27:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 263681 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=-14.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham 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 A9AEDC43465 for ; Mon, 21 Sep 2020 16:45:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6BCC1239D1 for ; Mon, 21 Sep 2020 16:45:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706713; bh=YPQ4dNRM4lUjQxVK3ZjG7yTeROoTNXMU8FZqKAgb/dk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=e6aaN1ex999dxoZgJtut4RfZKVetoKghSXX9nVCXwsnNVw4Ew+sr3mYj7BtOgB2DT UG8OMNLHHcS3s+zow1DolUD5sCs0BYDfKMv65kfU9es4USCy+zT2f14iownv0O8WCB s8IiW4fIoxmsrjy7g2ZadRA2sUbvMDm1QGeK8BRw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728427AbgIUQpM (ORCPT ); Mon, 21 Sep 2020 12:45:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:50908 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729032AbgIUQpJ (ORCPT ); Mon, 21 Sep 2020 12:45:09 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 62BCF235F9; Mon, 21 Sep 2020 16:45:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706709; bh=YPQ4dNRM4lUjQxVK3ZjG7yTeROoTNXMU8FZqKAgb/dk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PNFJ6jPIABgWvoka/0ZRTcB5GY+U4ulTd3Hm19Y31qyU60aw76tlp8XtUpwzJDPGY wNop3uEl/FCjl7Jkq8cxAwgJvNVoXe196Za1fnM44JNk1YvaiY1LMB8oID64ZBjrho 1hUGOG5wF+4OMakg+aZEgn93PaJZQlscx/5TgEs8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhi Li , "J. Bruce Fields" , Trond Myklebust , Sasha Levin Subject: [PATCH 5.8 022/118] SUNRPC: stop printk reading past end of string Date: Mon, 21 Sep 2020 18:27:14 +0200 Message-Id: <20200921162037.342549625@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921162036.324813383@linuxfoundation.org> References: <20200921162036.324813383@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: J. Bruce Fields [ Upstream commit 8c6b6c793ed32b8f9770ebcdf1ba99af423c303b ] Since p points at raw xdr data, there's no guarantee that it's NULL terminated, so we should give a length. And probably escape any special characters too. Reported-by: Zhi Li Signed-off-by: J. Bruce Fields Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- net/sunrpc/rpcb_clnt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index c27123e6ba80c..4a67685c83eb4 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c @@ -982,8 +982,8 @@ static int rpcb_dec_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr, p = xdr_inline_decode(xdr, len); if (unlikely(p == NULL)) goto out_fail; - dprintk("RPC: %5u RPCB_%s reply: %s\n", req->rq_task->tk_pid, - req->rq_task->tk_msg.rpc_proc->p_name, (char *)p); + dprintk("RPC: %5u RPCB_%s reply: %*pE\n", req->rq_task->tk_pid, + req->rq_task->tk_msg.rpc_proc->p_name, len, (char *)p); if (rpc_uaddr2sockaddr(req->rq_xprt->xprt_net, (char *)p, len, sap, sizeof(address)) == 0)