Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3730515pxb; Mon, 4 Oct 2021 08:24:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCVFFjwydxtKEkDxMIzEZ7OTWlVWoVUHQCfIpHm6xWmaX47CkItHvyPktRZmZQjFntUYCP X-Received: by 2002:a17:90b:14cd:: with SMTP id jz13mr18885109pjb.192.1633361095903; Mon, 04 Oct 2021 08:24:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633361095; cv=none; d=google.com; s=arc-20160816; b=Sjtu/rdiBHFWP5dJGa6ZTtzI5kU9pXI9JOUO+EGfkvvLzJfupvagFUiumvFlvhA4jD toodK7Z/TQcaAMNuCvNOzNb2CFGgyDMG3+GUpSouxc8/uCSVhBmwxXNKPXnAIcDgFU3N fjbSzSSZr3Bh27x5mn+56+byYlTSkTWBkv5k65Utdc0cnE2RLwsNWkFxzak9M49pTAFR sFqyxZw6RUiShkJf9/81M9M1AKQvQGL88QPD3goSGkAUhB8/IwU04aW36H6VUGWGicl6 UD5pZeOwn4mvVlvTTaKrqaQWOcEbd22JoDNXwIqt+UAarjP1JmfLw6iOIfm6niMLKuQK 8Cog== 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=ucBp5055U/k9FLYNVYHNdAsZ1SAKU7ZSQ4fSebaTOxY=; b=yeIXg/VlwqAtNEVrbYofD89se3d9M5WEckMvPkIsffUFDiQPSY/Nz7I/8ECh8aJU00 b3T0nG+s8bjfK/kuxZnuPZYMeJbMf5FmH+Q1c9sugj2NO+qZ4GGSvAGqnwsMjSL4yf7w sBe/5IooqiksVMbgep5iML/aLnVIxhTPOxfW1zFmFZycL7sdFOUOocrDVkBg8viNqIiS gIdGrZ0jR39ixP2Ty1/3ZB4s9VLWzFj+tPDJqXwW8muEccuS3vte/YObjNBhn2VMb/Pa AFsH6+TwiUhJsXn+5cx9fLUAstZnU4hjmqFi2ueKxWkjKkvkwFqughlstIv4P1jLIz73 RHjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=txksjmrc; 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 s191si17189675pgs.25.2021.10.04.08.24.38; Mon, 04 Oct 2021 08:24:55 -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=txksjmrc; 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 S235361AbhJDNOV (ORCPT + 99 others); Mon, 4 Oct 2021 09:14:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:45352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235969AbhJDNMT (ORCPT ); Mon, 4 Oct 2021 09:12:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2D77261B7C; Mon, 4 Oct 2021 13:04:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633352681; bh=ZMFTrj+G1zzL9POirBeOmm9akaZ2DUSRVUlKBDsS6DA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=txksjmrcaGbzV9MkigQlKxDZLbGIy7Bye70jSibtWsQjMyaubAkRDe9e9C1b9xTfP HSYpPRhjpFk598YkS510HnMMHLFAGLJbWqxniEkXLjIltN2ldeIlQwbImCsNIOjRTA 87zLMBo45I9s0k8Wf3zedlCeoJCsRcDd6bmlGpts= 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 4.19 79/95] ipack: ipoctal: fix missing allocation-failure check Date: Mon, 4 Oct 2021 14:52:49 +0200 Message-Id: <20211004125036.159612333@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004125033.572932188@linuxfoundation.org> References: <20211004125033.572932188@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 @@ -391,7 +391,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);