Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3992117pxb; Mon, 4 Oct 2021 14:39:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2+4pkbIMgNLuqTdYEIutj6oC+wE2g+2oMmUkf81fmGFNn1lYWO7NkUqv2dkcRR0H47790 X-Received: by 2002:a63:7d46:: with SMTP id m6mr13034641pgn.409.1633383556694; Mon, 04 Oct 2021 14:39:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633383556; cv=none; d=google.com; s=arc-20160816; b=HOl9eO2ooIBr6dCOIjzHiaPe+tF9ogWyfqHM4q12TlfDxzHHpt8aTPQb/KhxgVv8VU Gcg1eXe40Jrl66eeWDsUJSNPzAmteVVyigYKeyuXa6AYMvoD6HlSq+4gwiZvW3jRqGtE 0S7CIL6weB/zifYipqHNaKmRdztsG6WxV2xzM4zrrTYzrTJ969BxihH9LV0HXrd/USgv L1e9Gex3yAdipZYSMHVxEv948t7Po7xdDnNL1qtz7r7UljM2nIZZoyfwU6Tii1u3jlCs ng/74iDrucx++r0/P+cNhV6Al6Rgo4d28uoHt/Jkd5PMR+byaQG95XAWsBUAqp6IaAlW QNpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XuwZOPeJmcpdBj5aQjDmGki/4XwUu6CTOaRd1Bj4hYM=; b=xISDi/+vk6c9IHasO5ZaJPtp/ALgNlXQZYOE4vPg1EgRz1UQYDAwb05d6Gs985m4Dg IA9EcVUff37HX6BMXNYdmPNDfffYTa+zSUMxyI4qsZYofU08aFmbBN1PrmLVbtfE2/76 4pBTLbSdSwY+jrY5gb4gcMLn1r0gBjC09RUUOEUlEvAVwhZGEaVTxkiJUYYabX/zZ1pk 3XxS4Ct9I63ObtDSMBQ7LbNaIw0D/odptVDa74FuE3v4HptF+vfZbOq9OVzcJ3bHuFEJ 1p1juoZRz5iemPA+p/UceQZ6/SLkH0ZZ+Hx4MkznhtDzSusrhL+RTDLstNF/W9EGMtDT NYDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ywu85c1Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q4si18067049plb.162.2021.10.04.14.39.04; Mon, 04 Oct 2021 14:39:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ywu85c1Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238226AbhJDNlv (ORCPT + 99 others); Mon, 4 Oct 2021 09:41:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:51592 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238284AbhJDNkN (ORCPT ); Mon, 4 Oct 2021 09:40:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B05D663251; Mon, 4 Oct 2021 13:18:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633353496; bh=yV1Umhyi5YtwnfzNNWLC/Qa59ninjl6oXpt8uC/eaXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ywu85c1Z20oydW0etzUxoPPKGeIcftq0yJyCy0JTubCm+9pRrTcaalGlwFACzdf5a +lMOzKX1eMURkPy7kfDYYEA/lA/Y7hq7XslWTGQGZKJQWnBqUNI4VDmAYvYXArGEKc Og9KRaLLCQXSH8+jApc40Ex7uxMX/xaU1ICXSJZI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Samuel Iglesias Gonsalvez , Johan Hovold Subject: [PATCH 5.14 151/172] ipack: ipoctal: fix missing allocation-failure check Date: Mon, 4 Oct 2021 14:53:21 +0200 Message-Id: <20211004125049.847250379@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004125044.945314266@linuxfoundation.org> References: <20211004125044.945314266@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johan Hovold commit 445c8132727728dc297492a7d9fc074af3e94ba3 upstream. Add the missing error handling when allocating the transmit buffer to avoid dereferencing a NULL pointer in write() should the allocation ever fail. Fixes: ba4dc61fe8c5 ("Staging: ipack: add support for IP-OCTAL mezzanine board") Cc: stable@vger.kernel.org # 3.5 Acked-by: Samuel Iglesias Gonsalvez Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20210917114622.5412-5-johan@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/ipack/devices/ipoctal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/ipack/devices/ipoctal.c +++ b/drivers/ipack/devices/ipoctal.c @@ -386,7 +386,9 @@ static int ipoctal_inst_slot(struct ipoc channel = &ipoctal->channel[i]; tty_port_init(&channel->tty_port); - tty_port_alloc_xmit_buf(&channel->tty_port); + res = tty_port_alloc_xmit_buf(&channel->tty_port); + if (res) + continue; channel->tty_port.ops = &ipoctal_tty_port_ops; ipoctal_reset_stats(&channel->stats);