Received: by 2002:ac0:a874:0:0:0:0:0 with SMTP id c49csp234403ima; Fri, 15 Mar 2019 01:24:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEGaoJm4ZhCNd5ZJ9T4tro+JiKDEEoiG/KNn2VZcjs6UguIhCZ0jZKHVZhwbRhuKKHfAr1 X-Received: by 2002:a65:50c4:: with SMTP id s4mr2195790pgp.33.1552638271891; Fri, 15 Mar 2019 01:24:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552638271; cv=none; d=google.com; s=arc-20160816; b=nSYbv6PT5Twmu+HMAOiskBeUQ3QhJZEO5WpgyvTRVaG+vydTa9PucOOVKB6Ajpd15d sua1pR3Uyjzn9vhQur974Azn9A/NjPUDm9vhZ1zgI9wyBPqdSe6NCrbNnMP0admRdjbn hz20hg62q1gj/KaxpXRxTL5xK3c1yYvmvxQ+ElsNNpXhR6nrC6hHgxhgc6B0pBIpzoaD G6kf/O6d1QTPdcjgSrI40CyH3RPNGa7k3FCZdCLWqIZ8ODcctXveI9xGWR8z2/vol8fM z5a5o2fqCoebCwvWVSZGD8XUS/buhUR8gKOHWk1i0Io5/MgWDo0clJQXP64FLTs34bvB pRhw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=nYAOqF+UkURmisvufBsoD3AS0VPDSPIOdNATxulLqSQ=; b=oW+lPJOrNX5DKPg9T/lw95cOBmQM4JBj8ihs1qzgS+wGjtCE6dYCPs9vfVZ96DOWWK Fht08KHuc/g/ctzZZ6dF5OyqNjoKcFnZupbBucna2hbFVQyMjoZywDDBAr+IvMCxTVGT Hqu71kBrGYPrnWSQRB1qVD3lZqs965HW2VjRTGE6f8HjDqtHgZlIzt7uRMcddV18QTVn Y8IluGBwfmKcTHGPzcHqdiJmvyhjRExX/RZl4YbFqS7ZbTV5u8nlHZ/v4Xsmdoz+QOTC D0I9G7Ue25d14FA2lhYdHaHylaIid4U8vvEk53NUU0FP5V35RNXb05b9ggKYnkuAoBvN JuVA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j4si1149562pll.286.2019.03.15.01.24.16; Fri, 15 Mar 2019 01:24:31 -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; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727157AbfCOIWR (ORCPT + 99 others); Fri, 15 Mar 2019 04:22:17 -0400 Received: from mout01.posteo.de ([185.67.36.141]:51183 "EHLO mout01.posteo.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726584AbfCOIWR (ORCPT ); Fri, 15 Mar 2019 04:22:17 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 8F94A160064 for ; Fri, 15 Mar 2019 09:22:14 +0100 (CET) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 44LJTb4TXMz6tmL; Fri, 15 Mar 2019 09:22:11 +0100 (CET) Subject: Re: [PATCH v2] tty: atmel_serial: fix a NULL pointer dereference To: Kangjie Lu Cc: Greg Kroah-Hartman , Jiri Slaby , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches , linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20190315072709.22811-1-kjlu@umn.edu> From: Richard Genoud Message-ID: Date: Fri, 15 Mar 2019 09:22:11 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190315072709.22811-1-kjlu@umn.edu> Content-Type: text/plain; charset=utf-8 Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 15/03/2019 à 08:27, Kangjie Lu a écrit : > Fixes: 34df42f59a60 ("serial: at91: add rx dma support") The Fixes: tag should be just bellow the Signenf-off-by: tag > > In case dmaengine_prep_dma_cyclic fails, the fix returns a proper > error code to avoid NULL pointer dereference. > > Signed-off-by: Kangjie Lu ^^^ here > > --- > V2: simplified the patch as suggested by > Richard Genoud > --- > drivers/tty/serial/atmel_serial.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c > index 05147fe24343..41b728d223d1 100644 > --- a/drivers/tty/serial/atmel_serial.c > +++ b/drivers/tty/serial/atmel_serial.c > @@ -1288,6 +1288,10 @@ static int atmel_prepare_rx_dma(struct uart_port *port) > sg_dma_len(&atmel_port->sg_rx)/2, > DMA_DEV_TO_MEM, > DMA_PREP_INTERRUPT); > + if (!desc) { > + dev_err(port->dev, "Preparing DMA cyclic failed\n"); > + goto chan_err; > + } > desc->callback = atmel_complete_rx_dma; > desc->callback_param = port; > atmel_port->desc_rx = desc; > Thanks ! Richard.