From: Yang Shao <shaoyang@uniontech.com>
To: sudipm.mukherjee@gmail.com
Cc: marko.kohtala@gmail.com, akpm@osdl.org,
linux-kernel@vger.kernel.org, kernel@uniontech.com,
Yang Shao <shaoyang@uniontech.com>,
stable@vger.kernel.org
Subject: [PATCH] parport: fix inverted daisy selection result check
Date: Wed, 24 Jun 2026 09:36:03 +0800 [thread overview]
Message-ID: <20260624013603.1184198-1-shaoyang@uniontech.com> (raw)
parport_daisy_select() returns a boolean success result. It returns 1
when the requested daisy-chain device acknowledges the CPP selection
command and 0 otherwise.
Commit 7c9cc3be1094 ("[PATCH] parport: parport_daisy_select return
value fix") changed the helper from returning the raw
PARPORT_STATUS_ERROR bit to returning its logical negation. Selection
success therefore changed from a zero return value to a nonzero return
value, but parport_claim() retained the old zero-is-success test.
As a result, a successful selection does not update port->daisy, while
an unsuccessful selection can be recorded as the currently selected
daisy address. parport_open() later checks port->daisy to determine
whether the requested device was successfully selected, so this can
reject an existing device or accept a device address that was not
selected.
Test the return value directly and update port->daisy only after a
successful selection.
Fixes: 7c9cc3be1094 ("[PATCH] parport: parport_daisy_select return value fix")
Cc: stable@vger.kernel.org
Signed-off-by: Yang Shao <shaoyang@uniontech.com>
---
drivers/parport/share.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index c4c5869..2888005 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -1025,8 +1025,8 @@ int parport_claim(struct pardevice *dev)
/* If it's a daisy chain device, select it. */
if (dev->daisy >= 0) {
/* This could be lazier. */
- if (!parport_daisy_select(port, dev->daisy,
- IEEE1284_MODE_COMPAT))
+ if (parport_daisy_select(port, dev->daisy,
+ IEEE1284_MODE_COMPAT))
port->daisy = dev->daisy;
}
#endif /* IEEE1284.3 support */
--
2.47.3
next reply other threads:[~2026-06-24 1:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-24 1:36 Yang Shao [this message]
2026-07-27 7:00 ` Yang Shao
2026-07-27 13:59 ` Marko Kohtala
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=20260624013603.1184198-1-shaoyang@uniontech.com \
--to=shaoyang@uniontech.com \
--cc=akpm@osdl.org \
--cc=kernel@uniontech.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marko.kohtala@gmail.com \
--cc=stable@vger.kernel.org \
--cc=sudipm.mukherjee@gmail.com \
/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®