Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2242905imm; Thu, 18 Oct 2018 11:16:18 -0700 (PDT) X-Google-Smtp-Source: ACcGV63U8LdSLIB0b1rnIQSQHykB7zCJownl9weWQZGUvd6bZcDUqv1sMgbmsht9jOkLHxkVJxmp X-Received: by 2002:a62:6c4:: with SMTP id 187-v6mr31004982pfg.109.1539886578910; Thu, 18 Oct 2018 11:16:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539886578; cv=none; d=google.com; s=arc-20160816; b=tgPs9a5PW3DuADaF9V+w8FBG8bALu0R1ECrZ2OfMwWOXc3epC4IU7TFc5qXg57PHAq 7z5uQqxu7QTQp9k18TksChlUaUrSN8v1s/p4zyW+20HnWNKVdCuD5W0rS92VXfBqtMUJ KwEiT6HvNm6aZLHNbAZDrYtYxMNMj/AI6cDPv/YRL7+ARo0ldws9ILfE+LgHWGDtPr3b heEuU46zN74n54rZgvsno01W2hjKFCaJNTOu6VC+JL6XoOySc2Tjwtmh4J/I5Q5yQgKd +TuXqBb4aB/pJE0GPtrTz6rtZ6SyjuoatFYaEwn6NNNVkIS7BuT3HtcE7kEbH3PUT73y sbMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aeuHY6IwEZZCZV4acLO4cnv1qyiCrCWdO6bWoRf5nTY=; b=1Lq95G+6BZKI/Sg+aDk30qeFU9Pd19oqRUkniDkBhB3AgvrI5bcmMYvhQqyk+Iq3NF Gjlb/HOLYAJ8TgpfzIgN/vfvVc1MQvMuAqCaUk04iJ8zVGxcw1p2NgDOU70qmG4fmGak yc7E6hLqsJSILemwNevfcTlbQSxgJI4WLVEKMrWmaKzV7YjEY1+o3H21pxs0DlxSuHQq upY5jUYVu9qK/tsGJ8k6u7g0bHgM2cEa/+KzqL7UEVgvQXbQYgWEeNPw8CMm2f4bulwT lxhW29KKH/undH4UbxWr08t9odLuIWbdE0Cy6nhmJyVot1m/oy/hOWG2VS/cjSmuayoy HK7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fCjsDo1M; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 20-v6si21840386pgk.190.2018.10.18.11.16.03; Thu, 18 Oct 2018 11:16:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fCjsDo1M; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728767AbeJSCRF (ORCPT + 99 others); Thu, 18 Oct 2018 22:17:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:46514 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728674AbeJSB6t (ORCPT ); Thu, 18 Oct 2018 21:58:49 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (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 58FE2204FD; Thu, 18 Oct 2018 17:56:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539885404; bh=lPujtVlmo+CkSe2gt87JC7jgb7T2j7lFLXx1AXsTQJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fCjsDo1MS8gm8AGRCpj5qoV0k0XqSbzHYaoKshj04GdH1fMEsi0kvyI+SqCFOi7BY xPe4AuEvKG6fAe26OCwYEe76mcLFiEFoOH6SjkJLOmOlxpijgt4UgeyBVYyQWnllPO SBpSe5dPMsjfMv3clKuE/xGF+Tuob8MSPjiVbfbc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook , Laura Abbott , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.18 19/53] scsi: ibmvscsis: Ensure partition name is properly NUL terminated Date: Thu, 18 Oct 2018 19:54:12 +0200 Message-Id: <20181018175420.175850690@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181018175416.561567978@linuxfoundation.org> References: <20181018175416.561567978@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Laura Abbott [ Upstream commit adad633af7b970bfa5dd1b624a4afc83cac9b235 ] While reviewing another part of the code, Kees noticed that the strncpy of the partition name might not always be NUL terminated. Switch to using strscpy which does this safely. Reported-by: Kees Cook Signed-off-by: Laura Abbott Reviewed-by: Kees Cook Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c @@ -3478,7 +3478,7 @@ static int ibmvscsis_probe(struct vio_de snprintf(vscsi->eye, sizeof(vscsi->eye), "VSCSI %s", vdev->name); vscsi->dds.unit_id = vdev->unit_address; - strncpy(vscsi->dds.partition_name, partition_name, + strscpy(vscsi->dds.partition_name, partition_name, sizeof(vscsi->dds.partition_name)); vscsi->dds.partition_num = partition_number;