mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anton Vasilyev <vasilyev@ispras.ru>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Anton Vasilyev <vasilyev@ispras.ru>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Guenter Roeck <linux@roeck-us.net>,
	Samuel Holland <samuel@sholland.org>,
	Pan Bian <bianpan2016@163.com>,
	linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org
Subject: [PATCH] firmware: vpd: Fix section enabled flag on vpd_section_destroy
Date: Mon, 23 Jul 2018 19:48:57 +0300	[thread overview]
Message-ID: <20180723164857.24460-1-vasilyev@ispras.ru> (raw)

static struct ro_vpd and rw_vpd are initialized by vpd_sections_init()
in vpd_probe() based on header's ro and rw sizes.
In vpd_remove() vpd_section_destroy() performs deinitialization based
on enabled flag, which is set to true by vpd_sections_init().
This leads to call of vpd_section_destroy() on already destroyed section
for probe-release-probe-release sequence if first probe performs
ro_vpd initialization and second probe does not initialize it.

The patch adds changing enabled flag on vpd_section_destroy.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru>
---
 drivers/firmware/google/vpd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/firmware/google/vpd.c b/drivers/firmware/google/vpd.c
index e9db895916c3..5347c17c7108 100644
--- a/drivers/firmware/google/vpd.c
+++ b/drivers/firmware/google/vpd.c
@@ -246,6 +246,7 @@ static int vpd_section_destroy(struct vpd_section *sec)
 		sysfs_remove_bin_file(vpd_kobj, &sec->bin_attr);
 		kfree(sec->raw_name);
 		memunmap(sec->baseaddr);
+		sec->enabled = false;
 	}
 
 	return 0;
-- 
2.18.0


             reply	other threads:[~2018-07-23 16:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-23 16:48 Anton Vasilyev [this message]
2018-07-23 17:09 ` Dmitry Torokhov
2018-07-23 17:13 ` Guenter Roeck
2018-07-23 17:23   ` Dmitry Torokhov
2018-07-23 18:27     ` Guenter Roeck
2018-07-23 18:39       ` Dmitry Torokhov
2018-07-24 15:10         ` [PATCH v2] " Anton Vasilyev
2018-07-24 15:55           ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180723164857.24460-1-vasilyev@ispras.ru \
    --to=vasilyev@ispras.ru \
    --cc=bianpan2016@163.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ldv-project@linuxtesting.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=samuel@sholland.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®