Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp914177pxb; Wed, 3 Mar 2021 20:52:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJz1H6cJIEtzdPC40UcsizymEWAvPszg+Xt+MCKDv362uLWG8cysc4AnxiAnvywhjIk6bTyN X-Received: by 2002:a17:906:a86:: with SMTP id y6mr2275476ejf.354.1614833570957; Wed, 03 Mar 2021 20:52:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614833570; cv=none; d=google.com; s=arc-20160816; b=tJMdXpgK0+mnva5z2p5F+lwTHZOXx+p780LJ3VzRpKE6qNkL4A3bYL+34YMdlashxJ Fxz+VRp/2ybQbpx1bdO/czAayJ3+dKSsFPSm2FLLwrlapzmtVOOGWLLde16l6ktMai9O Rk1tmpJ9YvHKPXsJt6aU7lDc4NRX/eGZL2QKate+0GWiC71167w6N0IoWkayNJvJBc6d ZjFi/Zn5keGZRm+96TcUseSyeWQOWweNgL3ZHEhhKRHW14zj1J3kdMJ+OhftE9neFw1m bfvq3yUOg2S+2lm7hQi4So+t+A96cQJrLSCrTefBXuA66CX4l0X2QgAQiU0RlgbP8R5O LBag== 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=Sd7u09BUcsWh5l43H3YOWpkpYWGLBoYkOq+sXMwEctk=; b=l5nwKn+jCchbSXuE6bk50K9hPavErqo4Ph3kn+dMVdtuZD9BgSUhLPn23A7Jekspbv b0YbEif9g/vdlLnbCbFwVAny2t9R/fsgpj8JS+2BYknzHOq8txPPEN2RGLwOK28K9fIu DaResGk2VPWp9NuM8yMJTiz8+gpwf+Ml44g21ARICdTfzB3OgLDD//akjUwHW7oxJpKC GD39kECv2KH1Y9ZgoMdFbSkJcXnTE4fjHKRt7O/U2I55+RLKsszUEfFWyvlX+2XhX2/d R1ITimlyc7CD8OwKZQv9qfmXTHeMGi3lbqOBe7Ru+eTFu5XkYyMofmKrIqSVONxHjlSe PKYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B+Z4fuoG; 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 j17si17025937edw.10.2021.03.03.20.52.29; Wed, 03 Mar 2021 20:52:50 -0800 (PST) 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=B+Z4fuoG; 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 S1349112AbhCBCLq (ORCPT + 99 others); Mon, 1 Mar 2021 21:11:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:50712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236420AbhCATgF (ORCPT ); Mon, 1 Mar 2021 14:36:05 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 45B066507F; Mon, 1 Mar 2021 17:27:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614619639; bh=bp3/Ot32I15hlCTIiZtXMzjNIdzJRooVCi58UIoZhs4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B+Z4fuoGl6WF5fHLn5ed3S77ZNtAtXrh9Jn/l3xZh80eF7TJvsqlPLEMsmt/u9Ywh rZXx8Ecvji/41KgTgs/JPXU2Su6l569G5jzzONA2Mw7RcLiaKpsz5z+zJ7Itxm3SfY /eRZQwZhafoU3ace9gYP29DFFEhLGf/nDei1LcII= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Johan Hovold Subject: [PATCH 5.10 497/663] USB: serial: mos7840: fix error code in mos7840_write() Date: Mon, 1 Mar 2021 17:12:25 +0100 Message-Id: <20210301161206.437458753@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161141.760350206@linuxfoundation.org> References: <20210301161141.760350206@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: Dan Carpenter commit a70aa7dc60099bbdcbd6faca42a915d80f31161e upstream. This should return -ENOMEM instead of 0 if the kmalloc() fails. Fixes: 3f5429746d91 ("USB: Moschip 7840 USB-Serial Driver") Signed-off-by: Dan Carpenter Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/mos7840.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -883,8 +883,10 @@ static int mos7840_write(struct tty_stru if (urb->transfer_buffer == NULL) { urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_ATOMIC); - if (!urb->transfer_buffer) + if (!urb->transfer_buffer) { + bytes_sent = -ENOMEM; goto exit; + } } transfer_size = min(count, URB_TRANSFER_BUFFER_SIZE);