[PATCH 0/2] scsi: target: fix CHAP_N handling

David Disseldorp <[email protected]> Tue, 2 Jun 2026 21:43:56 +1000
Newsgroups org.kernel.vger.target-devel,org.kernel.vger.linux-scsi
Message-ID <[email protected]>
The sashiko bot pointed out issues with CHAP_N handling recently, when
reviewing a patch for a separate issue:
https://sashiko.dev/#/patchset/20260521151121.808477-1-hossu.alexandru%40gmail.com
  Since extract_param() unconditionally strips '0x' or '0b' prefixes and
  alters the returned type, wouldn't a valid user with a name like '0xalice' or
  '0bob' have their username mutated to 'alice' or 'ob'?

I believe this behaviour is contrary to the iSCSI spec. I added some simple
libiscsi tests to cover prefix stripping:
https://github.com/sahlberg/libiscsi/pull/472

These patches attempt to fix CHAP_N handling.

----------------------------------------------------------------
David Disseldorp (2):
      scsi: target: add extract_param_str() helper
      scsi: target: fix auth when CHAP_N carries a hex/b64 prefix

 drivers/target/iscsi/iscsi_target_auth.c |  8 ++---
 drivers/target/iscsi/iscsi_target_nego.c | 37 ++++++++++++++++++++++++
 drivers/target/iscsi/iscsi_target_nego.h |  1 +
 3 files changed, 40 insertions(+), 6 deletions(-)