From patchwork Fri Jan 24 09:25:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233043 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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable 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 70179C35242 for ; Fri, 24 Jan 2020 11:07:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3D6CB20708 for ; Fri, 24 Jan 2020 11:07:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579864058; bh=qABPxQ2/vxlZhPFh918x8elSwB+Eg1ojAlBRSJt9MUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=uZSlK0sO7T+WNm7qXjdljajZcFm5rfsXu0XDtJNg0uvhA87aqZuzBRYpX3Th+yICR 9KQlyU/2E2X4KFIAhcsf+h2g7TGsQleIyBgjQOgv/qI883BoLSdjC6/YE4qavXHo1K 9Nmg7yvxIIPw9SQdW8YFkXBW6WrWww/jfUp6Bixc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387910AbgAXLHS (ORCPT ); Fri, 24 Jan 2020 06:07:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:42452 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389422AbgAXLHR (ORCPT ); Fri, 24 Jan 2020 06:07:17 -0500 Received: from localhost (ip-213-127-102-57.ip.prioritytelecom.net [213.127.102.57]) (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 2BA892075D; Fri, 24 Jan 2020 11:07:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579864036; bh=qABPxQ2/vxlZhPFh918x8elSwB+Eg1ojAlBRSJt9MUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bW7jU+DJtHi2xyiTAhlW2dWP6yw/36x5YoH6yMDVOWDTHmRqjKR0pwlFgrVzUkQ+a eWYEA2+UqFgL25jp0Hnutx/97LEWTxtnYoteiI0f3CVo7XEtkJFDwpnYZ0XOHBBaaY CN0kTM1q7JGoZG3cRFWJUt8VifZ97fKFTejaNDVs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YueHaibing , Sasha Levin Subject: [PATCH 4.19 154/639] tty: ipwireless: Fix potential NULL pointer dereference Date: Fri, 24 Jan 2020 10:25:24 +0100 Message-Id: <20200124093106.503452802@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200124093047.008739095@linuxfoundation.org> References: <20200124093047.008739095@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: YueHaibing [ Upstream commit 7dd50e205b3348dc7784efbdf85723551de64a25 ] There is a potential NULL pointer dereference in case alloc_ctrl_packet() fails and returns NULL. Fixes: 099dc4fb6265 ("ipwireless: driver for PC Card 3G/UMTS modem") Signed-off-by: YueHaibing Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/ipwireless/hardware.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/ipwireless/hardware.c b/drivers/tty/ipwireless/hardware.c index b0baa4ce10f98..6bbf35682d531 100644 --- a/drivers/tty/ipwireless/hardware.c +++ b/drivers/tty/ipwireless/hardware.c @@ -1516,6 +1516,8 @@ static void ipw_send_setup_packet(struct ipw_hardware *hw) sizeof(struct ipw_setup_get_version_query_packet), ADDR_SETUP_PROT, TL_PROTOCOLID_SETUP, TL_SETUP_SIGNO_GET_VERSION_QRY); + if (!ver_packet) + return; ver_packet->header.length = sizeof(struct tl_setup_get_version_qry); /*