Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2989251pxb; Tue, 19 Jan 2021 10:43:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJxr4dRvtuYc2zAXGlZCzpUW/4ALQYsEfeFM69DtVHg9odBHcaXFC5aCEwVq6lfgai6qViN8 X-Received: by 2002:aa7:dac4:: with SMTP id x4mr2281175eds.192.1611081799058; Tue, 19 Jan 2021 10:43:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611081799; cv=none; d=google.com; s=arc-20160816; b=ZYouO9OvwiBRUiM+csrNKaDwEpmqfBmxiVwd0lNt2sXcjhitCFSvkaF8iemarHvT1G J9x1Pq1mquxb/HXg9Dwgn6OBZd3NIGKbBvf8GUXlw1IYojO1Zsf8W9Otv/1407s7yGoC iJSkC6M1VJZHNpCTyGPg7OLsr2ohBqfoGMTaNtOnIumH4UFaKT3mvnL4KatJyWA6Cvq8 pYwbMw1D+xzmvkpnX/PAYB2WFIYo4IxPdVKBQs05jD3amDD7TmjUK9Z9oOnZ+avf0blW VAVeOsbT20+FST3uBmmQ3dMtioLmeGEe82LKZGUKI/r37osCaJrbvhK+7K5yxCVyLH2N NIvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:organization:subject:cc:to:from; bh=byJ7JCthRsiqP4FB4f/Jt4RYJsha/xoMxmACiPzUza8=; b=Eip9X0HDaKNDxJtaBIeCSroNH7uPqxn9M6xJ/AVt8JzvK/uJam9QIWeylgSpCI1lhi +Lv0JNRhYmZf82iqKtdtpiqLSRKdnnpBXVLC2EtfnLwAc+GNxINaZ9uKE4TOhLGtr3zZ if1jijUSFBTHmF1Xb9dIFba9GyIbmIo7wenO4xA3GWEDiKgegOm1VtL3w1uKemS0mAC+ QATq51XdKrS31PmUxtbv/0poOkrV/A3sCq/fMzfLTGLY3w0IK5e6D3yUCL146nkPMJ8i EGWMxLxoGdYZCWB1wCPfq8crBxGM7J0OmLKguqkOD1bxTmip/JwoPZnb0p48KSKVlLLP BlvQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o19si703251edz.565.2021.01.19.10.42.55; Tue, 19 Jan 2021 10:43:19 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731704AbhASSj3 (ORCPT + 99 others); Tue, 19 Jan 2021 13:39:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391267AbhASSg0 (ORCPT ); Tue, 19 Jan 2021 13:36:26 -0500 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1874DC061757 for ; Tue, 19 Jan 2021 10:35:45 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id 2B0B91F4545D From: Gabriel Krisman Bertazi To: Paul Lawrence Cc: Jeff Dike , Richard Weinberger , Anton Ivanov , Christopher Obbard , linux-um@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] um: ubd: Fix crash from option parsing Organization: Collabora References: <20210119181945.2071053-1-paullawrence@google.com> Date: Tue, 19 Jan 2021 15:35:35 -0300 In-Reply-To: <20210119181945.2071053-1-paullawrence@google.com> (Paul Lawrence's message of "Tue, 19 Jan 2021 18:19:45 +0000") Message-ID: <871regg4g8.fsf@collabora.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Paul Lawrence writes: > Below patch will cause NULL ptr dereferences if the optional filenames > are not present. > > Fixes: ef3ba87cb7c9 (um: ubd: Set device serial attribute from cmdline) > Signed-off-by: Paul Lawrence Looks good. Reviewed-by: Gabriel Krisman Bertazi Totally unrelated, but it seems the original patch writes a "(null)" string to the sysfs attribute, if no serial is defined. I think we should have a default serial UBDX in case the user didn't provide any. Thanks, > --- > arch/um/drivers/ubd_kern.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c > index 13b1fe694b90..704989088f28 100644 > --- a/arch/um/drivers/ubd_kern.c > +++ b/arch/um/drivers/ubd_kern.c > @@ -371,15 +371,15 @@ static int ubd_setup_common(char *str, int *index_out, char **error_out) > > break_loop: > file = strsep(&str, ",:"); > - if (*file == '\0') > + if (file && *file == '\0') > file = NULL; > > backing_file = strsep(&str, ",:"); > - if (*backing_file == '\0') > + if (backing_file && *backing_file == '\0') > backing_file = NULL; > > serial = strsep(&str, ",:"); > - if (*serial == '\0') > + if (serial && *serial == '\0') > serial = NULL; > > if (backing_file && ubd_dev->no_cow) { -- Gabriel Krisman Bertazi